iBeans = Dead-simple integration for web app development
Upcoming SlideShare
Loading in...5
×
 

iBeans = Dead-simple integration for web app development

on

  • 2,833 views

Why does integration always seem to be the most time consuming and tedious part of Web app development? Mule iBeans (http://www.mulesoft.org/ibeans) provides a dramatically simpler approach to ...

Why does integration always seem to be the most time consuming and tedious part of Web app development? Mule iBeans (http://www.mulesoft.org/ibeans) provides a dramatically simpler approach to integrating your applications with data sources and services. iBeans allows your webapps, using Java or Javascript, to interact with other webapps and services by providing a simple API and annotations that enable your webapp to perform common tasks. Whether you are building a “full-boat” SOA infrastructure or just need a simple point-to-point solution embedded in your web app, the Mule iBeans open source project can help. Learn how to integrate cloud services like twitter, flickr and google into your Java apps with virtually no code.

Statistics

Views

Total Views
2,833
Views on SlideShare
2,807
Embed Views
26

Actions

Likes
0
Downloads
45
Comments
1

3 Embeds 26

http://www.linkedin.com 16
http://www.slideshare.net 9
http://wiki.hr.state.or.us:8080 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Would be very cool for someone to write an iBean for SlideShare's API (http://www.slideshare.net/developers). Should be an easy one and contribute it back to iBeans Central and get a nice iBeans fleece!
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

iBeans = Dead-simple integration for web app development iBeans = Dead-simple integration for web app development Presentation Transcript

  • iBeans = dead-simple integration + web app development Ken Yagen Silicon Valley Code Camp, October, 2009
  • Agenda
    • Introduction to Mule iBeans
    • Demo
    • How it works
    • Using iBeans
    • The Future of iBeans
    All contents Copyright © 2009, MuleSoft Inc.
  • What is an iBean?
    • A way to access external services, Facebook, AWS, eBay
    • A well-defined interface to a hosted service
      • ‘ service’ can be public or internal to your company
    • A Java interface with annotated method
    • A really easy way to create a reusable component
    All contents Copyright © 2009, MuleSoft Inc.
  • Introduction to Mule iBeans
    • Dramatically simplified integration for web applications
    • Simple API using annotations
    • Works with JSP, JSF, Struts, Spring, JavaScript
    • Task-based integration, e.g.:
      • Send/receive email
      • Subscribe to JMS queue
      • Poll RSS or Twitter feed
      • Publish REST service
    • Open source
    • Based on Mule
    All contents Copyright © 2009, MuleSoft Inc.
  • Do we need another framework?
    • Plenty of ESB/integration frameworks out there –
      • Mule, Open ESB, Camel, Spring Integration
    • All feel SOA-influenced
    • Not much for the WebApp developers who just wants grab data quickly
    • Focus on:
      • Dead simple API
      • Reuse
      • Task-based integration
    All contents Copyright © 2009, MuleSoft Inc.
  • Demo time All contents Copyright © 2009, MuleSoft Inc.
  • How it Works
    • Container-based approach
      • iBeans bundled with Tomcat, not WebApp
      • Auto discovery
    • Web Apps select services by adding servlet definitions
    • Full support for AJAX messaging and RPC
    • iBeans console used for updating and removing features
    • IBean and Application annotations
    • Modules for: Email, Scheduling, Atom, Jms, Rest, Ajax, Xml, Guice, Spring
    • Built with the cloud in mind
    Tomcat/Tcat Server/Mule Mule iBeans Web App 1 Web App 2 Web App 3 Cloud and data services All contents Copyright © 2009, MuleSoft Inc. iBeans Central Update Browse
  • The @Call and @UriParam Annotations public interface TwitterIBean { @Call (uri = " http://www.twitter.com/statuses/show/{id}.json ") String statusesShow( @UriParam (" id ") String id) throws CallException; } All contents Copyright © 2009, MuleSoft Inc.
  • The @State Annotation public interface TwitterIBean { @State void init( @UriParam (“ format ”) String format); @Call (uri = “ http://www.twitter.com/statuses/show/{id}.{format} ”) String statusesShow( @UriParam (" id ") String id) throws CallException; } All contents Copyright © 2009, MuleSoft Inc.
  • Static Defaults public interface TwitterIBean { @UriParam (“ format ”) static String DEFAULT_FORMAT = “ json ”; @State void init( @UriParam (“ format ”) String format); @Call (uri = " http://www.twitter.com/statuses/show/{id}.{format} ") String statusesShow( @UriParam (" id ") String id) throws CallException; } All contents Copyright © 2009, MuleSoft Inc.
  • The @ReturnType Annotation and Generic Types public interface TwitterIBean { @UriParam (“ format ”) static String DEFAULT_FORMAT = “ json ”; @State void init( @UriParam (“ format ”) String format, @ReturnType Class retType); @Call (uri = &quot; http://www.twitter.com/statuses/show/{id}.{format} &quot;) <T>T statusesShow( @UriParam (&quot; id &quot;) String id) throws CallException; } All contents Copyright © 2009, MuleSoft Inc.
  • Always provide sensible defaults public interface TwitterIBean { @UriParam (“ format ”) static String DEFAULT_FORMAT = “ json ” ; @ReturnType static Class DEFAULT_RETURN_TYPE = String. class ; @State void init( @UriParam (“ format ”) String format, @ReturnType Class retType); @Call (uri = &quot; http://www.twitter.com/statuses/show/{id}.{format} &quot;) <T>T statusesShow( @UriParam (&quot; id &quot;) String id) throws CallException; } All contents Copyright © 2009, MuleSoft Inc.
  • Testing the iBean public class TwitterIBeanTest extends AbstractIBeansTestCase { @IntegrationBean private TwitterIBean twitter; public void testTwitter() throws Exception { twitter.init(“ xml ”, Document. class ); Document doc = twitter.statusesShow(“ 1234567890 ”); } } All contents Copyright © 2009, MuleSoft Inc.
  • Other Annotations Annotation Description Type @HeaderParam Configures a header on the outgoing message Param, Field @PayloadParam Used for Http, configures a POST parameter Param @Payload Attaches data to the body of the message Param @State Will store values on the instance of the bean for later reference Method @PropertyParam Adds a property to the message that can be used later i.e. user/pass for authentication Param, Field All contents Copyright © 2009, MuleSoft Inc.
  • Transforming Response Data public class TwitterTransformers { @Transformer protected Status twitterXmlToStatus(Document doc) { String status = selectValue(&quot; /status/text &quot;, doc); String user = selectValue(&quot; /user/name &quot;, doc); return new Status(status, user); } } All contents Copyright © 2009, MuleSoft Inc.
  • public class TwitterIBeanTest extends AbstractIBeansTestCase { @IntegrationBean private TwitterIBean twitter; public void testTwitter() throws Exception { registerBeans( new TwitterTransformers()); twitter.init(“ xml ”, Status. class ); Status status = twitter.statusesShow(“ 1234567890 ”); } } Testing iBeans All contents Copyright © 2009, MuleSoft Inc.
  • Application Annotations Annotation Description Type @Schedule Cron scheduling for calling a method, can be used to poll channels Method @Receive Receive Data on a channel URI Method @Send Send the return of the method on a channel URI Method @ReceiveAndReply Receive Data on a channel URI and send the return back to the caller Method All contents Copyright © 2009, MuleSoft Inc.
  • @Schedule, @Send Example public class TwitterSchedule { @IntegrationBean private TwitterIBean twitter; @Schedule (interval = 5000) @Send (uri = &quot; ajax:///ibeans/ajax/twitter &quot;) public Document getTimeline() throws Exception { twitter.init(“ xml ”, Document. class ) return twitter.getPublicTimeline(); } } All contents Copyright © 2009, MuleSoft Inc.
  • iBeans Console All contents Copyright © 2009, MuleSoft Inc.
  • iBeans Shell
    • Groovy-based iBeans shell
    • List, create iBeans
    • Get help for an iBean
    • Test an ibean really quickly
    All contents Copyright © 2009, MuleSoft Inc.
  • Topics we may not have covered
    • Error Handling
    • ParamFactory for creating complex headers and parameters
      • i.e. Amazon secure hash params for EC2
    • Using generic VariableType return types to allow users to set the data format
    • Authentication
    All contents Copyright © 2009, MuleSoft Inc.
  • The Future of iBeans
    • Web Services support (JAX-RS)
    • Support for scripting in the console
    • Combine with Tcat for cloud development and provisioning
    • Centralized configuration (Mule Registry)
    • Mule 3.0 will be able to host iBeans
    • Support for other languages: Scala, Ruby, Clojure, etc
    • Could become the WCF for the JVM…
    All contents Copyright © 2009, MuleSoft Inc.
  • ???
    • Links for Mule iBeans:
      • Homepage: http://www.mulesoft.org/display/IBEANS/Home
    • Links for Tcat:
      • Homepage: http://mulesoft.com/tcat
    • About me:
      • Blog: http://blog.mulesoft.org
      • Twitter: http://twitter.com/kenyagen
      • Company: http://mulesoft.com
    All contents Copyright © 2009, MuleSoft Inc.