Camel as a_glue

2,288 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,288
On SlideShare
0
From Embeds
0
Number of Embeds
1,344
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Camel as a_glue

  1. 1. Camelas a Glue
  2. 2. Project. How we planned it
  3. 3. Project. How we imagine it.
  4. 4. Project. In practice.
  5. 5. Integration project. In practice.
  6. 6. How to handle it?
  7. 7. RTFM.Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions
  8. 8. Specific tool• Apache Camel• Spring Integration• Enterprise Service Bus (Mule ESB) Read article
  9. 9. Apache Camel. Pros.Pros• Lighweight• A lot components• Support many Data Formats• Good community• DSL(XML, Java, Scala, Groovy)• Spring integration
  10. 10. Apache Camel. Cons.• Messy documentations
  11. 11. Basic example. XML DSLcamel-config.xml<camelContext>…………………………………………………. <route> <from uri="servlet:///my_url" /> <bean ref=“urlHandler” method=“handle" /> <transform> <constant>DONE</constant> </transform> </route>………………………………………………….</camelContext>
  12. 12. Basic example. JAVA DSL public class MyRouteBuilder extends RouteBuilder{ public void configure() { from(" servlet:///my_url "). process(new UrlHandler()).to("direct:b"); }};Orpublic class MyRouteBuilder extends RouteBuilder{ public void configure() { from(" servlet:///my_url "). processRef(“urlHandler”).to("direct:b"); }};
  13. 13. Processor@Component(“urlHandler”)public class UrlHandler{ public void handle(Exchange ex){ ex.getIn(); //handle input }}
  14. 14. More complex example<route> <from uri="activemq:queue:queueName" /> <unmarshal ref="xstream-utf8" /> <bean ref=“firstProcessor" method="process" /> <bean ref=“secondProcessor" method="process" />……………………………………………………………………………………. <bean ref=“lastProcessor" method="process" /> <to uri="direct:anotherRoute" /></route>
  15. 15. Components• Amazon stack• Apache stack(service miz, fop, cxf,)• DBs(jdbc, jpa, ibatis)• EJB• File(ftp, ftps, file, hdfs)• Google stack(gae, guice, gmail, gtask)• Hazelcast• JMS• JMX• Mail (IMAP, POP)• Queues• Twitter• Many others
  16. 16. Components exampleTo poll, every 5 sec., all statuses on your home timeline and send to gmail:Java DSLfrom("twitter://timeline/home?type=polling&delay=5&consumerKey=[s]&co nsumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]").to("gmail://a ccount1@gmail.com")XML DSL<route> <from uri="twitter://timeline/home?type=polling&delay=5&consumerKey=[s]&c onsumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]"/> <to uri=" gmail://account1@gmail.com "/></route>
  17. 17. Data Formats• Standard java serialization• Object marshalling (json, protobuf)• Object xml marshalling (xstream, jaxb, jixb, castor, xmlbeans• Object/XML/Webservice marshalling (SOAP)• Direct JSON / XML marshalling• Flat data structure marshalling (BeanIO, bindy, csv, edi, flatpack dataformat)• Domain specific marshalling (HL7)• Compression (gzip, zip)• Security (Crypto, PGP, XMLsecurity)• Misc (custom dataformat, rss, syslog, tidymarkup)• Dozer Type Conversion
  18. 18. Marshalling example<route> <from uri="direct:start"/> <marshal ref="myJaxb"/> <to uri="direct:marshalled"/></route><route> <from uri="direct:marshalled"/> <unmarshal ref="myJaxb"/> <to uri="mock:result"/></route>
  19. 19. EIP• Dynamic Router• Recipient List• Message Filter• Wire Tap• Throttler• Load Balancer• Multicast• Others
  20. 20. Summary
  21. 21. Questions?

×