iBeans = Dead-simple integration for web app development

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

1 Event

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

  1. iBeans = dead-simple integration + web app development Ken Yagen Silicon Valley Code Camp, October, 2009
  2. Agenda
    • Introduction to Mule iBeans
    • Demo
    • How it works
    • Using iBeans
    • The Future of iBeans
    All contents Copyright © 2009, MuleSoft Inc.
  3. 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.
  4. 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.
  5. 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.
  6. Demo time All contents Copyright © 2009, MuleSoft Inc.
  7. 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
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. @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.
  19. iBeans Console All contents Copyright © 2009, MuleSoft Inc.
  20. 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.
  21. 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.
  22. 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.
  23. ???
    • 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.
SlideShare Zeitgeist 2009

+ Ken YagenKen Yagen Nominate

custom

270 views, 0 favs, 1 embeds more stats

Why does integration always seem to be the most tim more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 270
    • 269 on SlideShare
    • 1 from embeds
  • Comments 1
  • Favorites 0
  • Downloads 3
Most viewed embeds
  • 1 views on http://wiki.hr.state.or.us:8080

more

All embeds
  • 1 views on http://wiki.hr.state.or.us:8080

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories