iBeans dead-simple integration for the web
about me <ul><li>Creator of the Mule ESB Project 2003 </li></ul><ul><li>Founder, MuleSoft </li></ul><ul><li>Creator of iBe...
agenda <ul><li>Introduction to iBeans </li></ul><ul><li>The API  </li></ul><ul><li>Code dive </li></ul><ul><li>Demo </li><...
overview
goals <ul><li>Integration for the Web </li></ul><ul><li>No SOA  </li></ul><ul><li>Minimal concepts, no TLAs </li></ul><ul>...
server ‘api’ <ul><li>Application annotations </li></ul><ul><ul><li>receive and send data </li></ul></ul><ul><ul><li>schedu...
client ‘api’ <ul><li>iBeans - simple objects that talk to stuff </li></ul>
Application Annotations
annotations: schedule public class  MyObject  { @Schedule( interval=“ 60000 ” ) String shoutOut( )  { return  “ Hey what’s...
annotations: schedule with cron public class  MyObject  { @Schedule( cron=“ 0 * * * * ? ” ) String shoutOut( )  { return  ...
annotations: scheduled send public class  MyObject  { @Schedule( cron=“ 0 * * * * ? ” ) @Send( uri=“ xmpp://${jabber.creds...
annotations: receive public class  MyObject  { @Receive( uri=“ jms://my.queue ” ) void  onMessage(Object msg )  { log(msg)...
annotations: polling receive public class  MyObject  { @Schedule( cron=“ 0 0 12 * * ? ” ) @Receive( uri=“ jms://my.queue ”...
Architecture
architecture Runtime Container: Tomcat, Tcat, (Mule) iBeans Channels:  HTTP, SMTP, IMAP, WS, REST, JDBC, JMS, XMPP, FTP, A...
ibeans central Runtime Container: Tomcat, Tcat, (Mule) iBeans Channels:  HTTP, SMTP, IMAP, WS, REST, JDBC, JMS, XMPP, FTP,...
iBean Objects
what are ibeans? <ul><li>A way to access services </li></ul><ul><ul><li>Facebook, AWS, eBay, Twitter </li></ul></ul><ul><l...
what are ibeans? <ul><li>Encapsulate a service in a way that users don’t need to read the manual </li></ul><ul><li>Use in ...
ibeans in java public class  MyObject { @IntegrationBean private  TwitterIBean twitter; public void  logTimeline() { twitt...
ibeans in javascript <ul><li><script  type = &quot; text/javascript ”> </li></ul><ul><li>var  ibeans =  new  IBeansClient(...
create an ibean <ul><li>A Java interface with annotated methods </li></ul><ul><li>A definition of how to talk to a service...
create an ibean <ul><li>public interface  MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>@Call( uri=&quot; http://tw...
ibeans can have state <ul><li>public interface  MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>@State </li></ul><ul>...
ibeans can have defaults <ul><li>public interface  MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>@UriParam( “ forma...
Transforms & Bindings
transforms <ul><li>Transformers convert one object to another </li></ul><ul><ul><li>String to a URL </li></ul></ul><ul><ul...
transforms <ul><li>Transformers are discovered not configured </li></ul><ul><ul><li>Based on the current object received a...
transforms public class  SimpleTransformers  { @Transformer URL toUrl(String string )  throws  MalformedURLException  { re...
bindings <ul><li>Marshal and Unmarshal Objects </li></ul><ul><ul><li>XML (JAXB) </li></ul></ul><ul><ul><ul><li>XML documen...
bindings: jaxb public class  JaxbTransformers  { @Transformer Order toOrder(Document doc, JAXBContext jaxb )  throws … { U...
bindings: jaxb public class  MyObject  { @Receive( uri=“ jms://my.queue ” ) void  onMessage( @MessagePayload  Order order ...
… but wait <ul><li>How do we go from a Jms Message to an Xml Document? </li></ul><ul><li>Jms Message is normalized </li></...
… and we need to add… public class  JaxbTransformers  { @Transformer( sourceTypes={String. class } ) Order toOrder(Documen...
transform flow
ibeans can use transformers <ul><li>public interface  MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>… </li></ul><ul...
coding with ibeans <ul><li>Eclipse IDE plugin </li></ul><ul><li>Maven Archetypes, Run targets </li></ul><ul><li>Template p...
Framework Support
guice <ul><li>public class  MyModule  extends  AbstractGuiceIBeansModule </li></ul><ul><li>{  </li></ul><ul><li>protected ...
spring <ul><li><beans …> </li></ul><ul><li><bean  name =&quot; ibeansContext ”  </li></ul><ul><li>class =&quot; org.mule.i...
coming soon <ul><li>GWT / GXT </li></ul><ul><li>Grails </li></ul><ul><li>Play Framework </li></ul><ul><li>JSF </li></ul><u...
other things <ul><li>Support for JavaScript and AJAX </li></ul><ul><li>iBeans has a Groovy shell  </li></ul><ul><ul><li>Ex...
possibilities <ul><li>Great for embedding </li></ul><ul><ul><li>Cloud containers </li></ul></ul><ul><ul><li>Wikis: Conflue...
Whats next for ibeans <ul><li>Web Services support (JAX-RS/WS) </li></ul><ul><li>Support for scripting in the console </li...
… and after that <ul><li>Support for other languages: Scala, Ruby, Clojure, etc </li></ul><ul><li>Become the WCF for the J...
thanks <ul><li>web: http://mulesoft.org/ibeans </li></ul><ul><li>blog:   http://blog.rossmason.com </li></ul><ul><li>twitt...
Ibeans Dead Simple Integration
Upcoming SlideShare
Loading in...5
×

Ibeans Dead Simple Integration

2,128

Published on

Many web applications need integration capabilities but don't want to build an ESB solution. Typically, they want a simple solution for performing common integration tasks such as receiving and sending messages over Email, JMS or calling a Web Service. This talk will cover some options available that greatly reduce the amount of code and effort for performing these tasks without introducing new complexities or architecture considerations using new framework - iBeans.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,128
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
22
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • Dramatically simplified integration for Tomcat applications Simple API using annotations – no concepts or architecture Works in conjunction with other open source frameworks (e.g., JSP, JSF, Struts, Spring) Task-based integration, e.g.: Send/receive email Subscribe to JMS queue Poll RSS or Twitter feed Publish REST service Built with the cloud in mind Ideal for open source community model – “App Store for iBeans”
  • Where does the data go?
  • Ibeans Dead Simple Integration

    1. 1. iBeans dead-simple integration for the web
    2. 2. about me <ul><li>Creator of the Mule ESB Project 2003 </li></ul><ul><li>Founder, MuleSoft </li></ul><ul><li>Creator of iBeans </li></ul><ul><li>15 years of hooking s#!t together </li></ul><ul><li>Lazy </li></ul>
    3. 3. agenda <ul><li>Introduction to iBeans </li></ul><ul><li>The API </li></ul><ul><li>Code dive </li></ul><ul><li>Demo </li></ul><ul><li>The future of iBeans </li></ul>
    4. 4. overview
    5. 5. goals <ul><li>Integration for the Web </li></ul><ul><li>No SOA </li></ul><ul><li>Minimal concepts, no TLAs </li></ul><ul><li>Reuse </li></ul><ul><li>Task-focused </li></ul><ul><li>Cross-platform; Java, JS, Scala, JRuby </li></ul>
    6. 6. server ‘api’ <ul><li>Application annotations </li></ul><ul><ul><li>receive and send data </li></ul></ul><ul><ul><li>schedule tasks </li></ul></ul><ul><ul><li>create request / response services </li></ul></ul><ul><ul><li>HTTP, JMS, DB, FTP, etc </li></ul></ul>
    7. 7. client ‘api’ <ul><li>iBeans - simple objects that talk to stuff </li></ul>
    8. 8. Application Annotations
    9. 9. annotations: schedule public class MyObject { @Schedule( interval=“ 60000 ” ) String shoutOut( ) { return “ Hey what’s up? ”; } } }
    10. 10. annotations: schedule with cron public class MyObject { @Schedule( cron=“ 0 * * * * ? ” ) String shoutOut( ) { return “ Hey what’s up? ”; } } }
    11. 11. annotations: scheduled send public class MyObject { @Schedule( cron=“ 0 * * * * ? ” ) @Send( uri=“ xmpp://${jabber.creds}@jabber.org:6666/myGroup?groupChat=true ” ) String shoutOut( ) { return “ Hey what’s up? ”; } }
    12. 12. annotations: receive public class MyObject { @Receive( uri=“ jms://my.queue ” ) void onMessage(Object msg ) { log(msg); } } }
    13. 13. annotations: polling receive public class MyObject { @Schedule( cron=“ 0 0 12 * * ? ” ) @Receive( uri=“ jms://my.queue ” ) void onMessage(Object msg ) { log(msg); } } }
    14. 14. Architecture
    15. 15. architecture Runtime Container: Tomcat, Tcat, (Mule) iBeans Channels: HTTP, SMTP, IMAP, WS, REST, JDBC, JMS, XMPP, FTP, ATOM Annotations (API) Transform and bindings Scheduler Web apps apps web your console
    16. 16. ibeans central Runtime Container: Tomcat, Tcat, (Mule) iBeans Channels: HTTP, SMTP, IMAP, WS, REST, JDBC, JMS, XMPP, FTP, ATOM Annotations (API) Transforms and bindings Scheduler Web apps apps web your console iBeans Central repository
    17. 17. iBean Objects
    18. 18. what are ibeans? <ul><li>A way to access services </li></ul><ul><ul><li>Facebook, AWS, eBay, Twitter </li></ul></ul><ul><li>A well-defined interface to a service </li></ul><ul><ul><li>‘ service’ - public or internal </li></ul></ul><ul><ul><li>HTTP, JMS, FTP, JDBC, etc. </li></ul></ul>
    19. 19. what are ibeans? <ul><li>Encapsulate a service in a way that users don’t need to read the manual </li></ul><ul><li>Use in Java and JavaScript </li></ul><ul><ul><li>more languages to follow </li></ul></ul><ul><li>Re-usable, publish to iBeans Central </li></ul><ul><ul><li>Or a private repository </li></ul></ul>
    20. 20. ibeans in java public class MyObject { @IntegrationBean private TwitterIBean twitter; public void logTimeline() { twitter.setCredentials(“ user ”, “ shhhh ”); log(twitter.getFriendTimeline()); } }
    21. 21. ibeans in javascript <ul><li><script type = &quot; text/javascript ”> </li></ul><ul><li>var ibeans = new IBeansClient(); </li></ul><ul><li>creds = ibeans.config.get(“ twitter.user ”, “ twitter.pass ”); </li></ul><ul><li>ibeans.twitter.setCredentials(creds[0], creds[1]); </li></ul><ul><li>ibeans.twitter.getFriendTimeline(readTweets); </li></ul><ul><li>function readTweets(tweets, error) { </li></ul><ul><li>//do stuff </li></ul><ul><li>} </li></ul><ul><li></script> </li></ul>
    22. 22. create an ibean <ul><li>A Java interface with annotated methods </li></ul><ul><li>A definition of how to talk to a service </li></ul><ul><ul><li>Not the code to actually do it </li></ul></ul>
    23. 23. create an ibean <ul><li>public interface MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>@Call( uri=&quot; http://twitter.com/statuses/show/{id}.json &quot; ) </li></ul><ul><li>String statusesShow( @UriParam( &quot; id &quot; ) String id) </li></ul><ul><li>throws CallException; </li></ul><ul><li>} </li></ul>
    24. 24. ibeans can have state <ul><li>public interface MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>@State </li></ul><ul><li>void init( @UriParam( “ format ” ) String format); </li></ul><ul><li>@Call( uri=&quot; http://twitter.com/statuses/show/{id}.{format} &quot; ) </li></ul><ul><li>String statusesShow( @UriParam( &quot; id &quot; ) String id) throws … ; </li></ul><ul><li>} </li></ul>
    25. 25. ibeans can have defaults <ul><li>public interface MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>@UriParam( “ format ” ) </li></ul><ul><li>static String DEFAULT_FORMAT = “ json ”; </li></ul><ul><li>@State </li></ul><ul><li>void init( @UriParam( “ format ” ) String format); </li></ul><ul><li>@Call( uri=&quot; http://twitter.com/statuses/show/{id}.{format} &quot; ) </li></ul><ul><li>String statusesShow( @UriParam( &quot; id &quot; ) String id) throws … ; </li></ul><ul><li>} </li></ul>
    26. 26. Transforms & Bindings
    27. 27. transforms <ul><li>Transformers convert one object to another </li></ul><ul><ul><li>String to a URL </li></ul></ul><ul><ul><li>Transform XML; Xquery, XSLT </li></ul></ul><ul><ul><li>Enrich data </li></ul></ul>
    28. 28. transforms <ul><li>Transformers are discovered not configured </li></ul><ul><ul><li>Based on the current object received and the object type required by a method parameter. </li></ul></ul><ul><li>Annotations for injecting meta data </li></ul><ul><ul><li>Message headers* </li></ul></ul><ul><ul><li>Attachments* </li></ul></ul><ul><li>* not shown today </li></ul>
    29. 29. transforms public class SimpleTransformers { @Transformer URL toUrl(String string ) throws MalformedURLException { return new URL(string); } }
    30. 30. bindings <ul><li>Marshal and Unmarshal Objects </li></ul><ul><ul><li>XML (JAXB) </li></ul></ul><ul><ul><ul><li>XML document to an Order object </li></ul></ul></ul><ul><ul><li>JSON (Jackson) </li></ul></ul><ul><ul><ul><li>JSON String to a TwitterUser object </li></ul></ul></ul><ul><li>Supports automatic handling </li></ul>
    31. 31. bindings: jaxb public class JaxbTransformers { @Transformer Order toOrder(Document doc, JAXBContext jaxb ) throws … { Unmarshaller u = jaxb.createUnmarshaller(); return (Order) u.unmarshal(selectOne(“ /env/order ”, doc); } }
    32. 32. bindings: jaxb public class MyObject { @Receive( uri=“ jms://my.queue ” ) void onMessage( @MessagePayload Order order ) { log(order); } } Tells iBeans to transform the JMS Payload to an Order object
    33. 33. … but wait <ul><li>How do we go from a Jms Message to an Xml Document? </li></ul><ul><li>Jms Message is normalized </li></ul><ul><ul><li>TextMessage – String </li></ul></ul><ul><ul><li>BytesMessage – byte[ ] </li></ul></ul><ul><ul><li>ObjectMessage – Deserialized Object </li></ul></ul><ul><ul><li>etc </li></ul></ul>
    34. 34. … and we need to add… public class JaxbTransformers { @Transformer( sourceTypes={String. class } ) Order toOrder(Document doc, JAXBContext jaxb) throws … { Unmarshaller u = jaxb.createUnmarshaller(); return (Order) u.unmarshal(selectOne(“/env/order”, doc); } }
    35. 35. transform flow
    36. 36. ibeans can use transformers <ul><li>public interface MyTwitterIBean </li></ul><ul><li>{ </li></ul><ul><li>… </li></ul><ul><li>@State </li></ul><ul><li>void init( @UriParam( “ format ” ) String format, </li></ul><ul><li>@ReturnType Class retType ); </li></ul><ul><li>@Call( uri=&quot; http://twitter.com/statuses/show/{id}.{format} &quot; ) </li></ul><ul><li><T> T statusesShow( @UriParam( &quot; id &quot; ) String id) throws … ; </li></ul><ul><li>} </li></ul>
    37. 37. coding with ibeans <ul><li>Eclipse IDE plugin </li></ul><ul><li>Maven Archetypes, Run targets </li></ul><ul><li>Template projects </li></ul><ul><li>No Support for IntelliJ yet… </li></ul>
    38. 38. Framework Support
    39. 39. guice <ul><li>public class MyModule extends AbstractGuiceIBeansModule </li></ul><ul><li>{ </li></ul><ul><li>protected void doConfigure() throws Exception </li></ul><ul><li>{ </li></ul><ul><li>bind(EchoService. class ).asEagerSingleton(); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
    40. 40. spring <ul><li><beans …> </li></ul><ul><li><bean name =&quot; ibeansContext ” </li></ul><ul><li>class =&quot; org.mule.ibeans.spring. </li></ul><ul><li>IBeansContextFactoryBean &quot;/> </li></ul><ul><li>… </li></ul><ul><li></beans> </li></ul>
    41. 41. coming soon <ul><li>GWT / GXT </li></ul><ul><li>Grails </li></ul><ul><li>Play Framework </li></ul><ul><li>JSF </li></ul><ul><li>Struts 2 (may already work) </li></ul>
    42. 42. other things <ul><li>Support for JavaScript and AJAX </li></ul><ul><li>iBeans has a Groovy shell </li></ul><ul><ul><li>Execute scripts interactively or command-line </li></ul></ul><ul><li>iBeans Console </li></ul><ul><ul><li>Configure your iBeans instance </li></ul></ul><ul><ul><li>Browser and Download from iBeans Central </li></ul></ul>
    43. 43. possibilities <ul><li>Great for embedding </li></ul><ul><ul><li>Cloud containers </li></ul></ul><ul><ul><li>Wikis: Confluence, Xwiki </li></ul></ul><ul><li>DSLs </li></ul><ul><li>Mobile apps </li></ul><ul><li>Widgets </li></ul>
    44. 44. Whats next for ibeans <ul><li>Web Services support (JAX-RS/WS) </li></ul><ul><li>Support for scripting in the console </li></ul><ul><li>Centralized configuration </li></ul><ul><li>Mule 3.0 will be able to host iBeans </li></ul><ul><li>Combine with Tcat for cloud development </li></ul>
    45. 45. … and after that <ul><li>Support for other languages: Scala, Ruby, Clojure, etc </li></ul><ul><li>Become the WCF for the JVM? </li></ul>
    46. 46. thanks <ul><li>web: http://mulesoft.org/ibeans </li></ul><ul><li>blog: http://blog.rossmason.com </li></ul><ul><li>twitter: @rossmason </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×