Download - Progress FUSE Overview
![Page 1: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/1.jpg)
Willem JiangSenior Engineer Progress Software2010-08
Apache Camel
1
![Page 2: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/2.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Who is Willem Jiang ?
•Senior Software Engineer at Progress Software
Working on Apache project for about 5 years
Full time Apache Camel and CXF committer and PMC member
• Contact
http://willem.blogspot.com
http://jnn.javaeye.com
http://twitter.com/willemjiang
2
2
![Page 3: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/3.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Agenda
What is Apache Camel EIP examples Some cool features of Camel Riding tips of camel Q and A
3
3
![Page 4: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/4.jpg)
© 2009 Progress Software Corporation. All rights reserved.
What is Camel?
4
4
![Page 5: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/5.jpg)
© 2009 Progress Software Corporation. All rights reserved.
A Little History of Camel
Camel is found as a sub project of ActiveMQ The first code is committed
• r519901 | jstrachan | 2007-03-19 11:54:57 +0100 (Mon, 19 Mar 2007) | 1 line
• Initial checkin of Camel routing library Some codes were came from ServiceMix
• ServiceMix EIP component • some other ServiceMix components
Apache Camel 1.0 released June 2007 Apache Camel 2.0 released August 2009 Apache Camel 2.4 released July 2010 Apache Camel is more than 3 years old
5
5
![Page 6: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/6.jpg)
© 2009 Progress Software Corporation. All rights reserved.
ServiceMix, ActiveMQ, CXF and Camel
6
6
![Page 7: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/7.jpg)
© 2009 Progress Software Corporation. All rights reserved.
ServiceMix, ActiveMQ, CXF and Camel
ServiceMix is an open source ESB.
6
6
![Page 8: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/8.jpg)
© 2009 Progress Software Corporation. All rights reserved.
ServiceMix, ActiveMQ, CXF and Camel
ServiceMix is an open source ESB. ActiveMQ is an open source messaging provider.
6
6
![Page 9: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/9.jpg)
© 2009 Progress Software Corporation. All rights reserved.
ServiceMix, ActiveMQ, CXF and Camel
ServiceMix is an open source ESB. ActiveMQ is an open source messaging provider. CXF is an open source service framework.
6
6
![Page 10: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/10.jpg)
© 2009 Progress Software Corporation. All rights reserved.
ServiceMix, ActiveMQ, CXF and Camel
ServiceMix is an open source ESB. ActiveMQ is an open source messaging provider. CXF is an open source service framework.
6
Camel is an open source integration framework based on known Enterprise Integration Patterns.
6
![Page 11: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/11.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
7
7
![Page 12: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/12.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?
7
7
![Page 13: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/13.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks
7
7
![Page 14: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/14.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
7
7
![Page 15: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/15.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?
7
7
![Page 16: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/16.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)
7
7
![Page 17: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/17.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)
7
7
![Page 18: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/18.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)• Event Driven (High performance with a good scalability)
7
7
![Page 19: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/19.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)• Event Driven (High performance with a good scalability)
How about an Integration Framework ?
7
7
![Page 20: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/20.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)• Event Driven (High performance with a good scalability)
How about an Integration Framework ?• Your application code will not touch with any middleware API
7
7
![Page 21: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/21.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)• Event Driven (High performance with a good scalability)
How about an Integration Framework ?• Your application code will not touch with any middleware API• You can focus on your business
7
7
![Page 22: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/22.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)• Event Driven (High performance with a good scalability)
How about an Integration Framework ?• Your application code will not touch with any middleware API• You can focus on your business • Let the framework do the heave lift work for you
7
7
![Page 23: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/23.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Integration Framework
Why we need to do the integration?• Application is built on different tech stacks• We want to make apps work together
How can we do it ?• Big Database (Integration the data, it’s not a good one)• Message follow (Let the Applications talk to each other)• Event Driven (High performance with a good scalability)
How about an Integration Framework ?• Your application code will not touch with any middleware API• You can focus on your business • Let the framework do the heave lift work for you
7
A Camel can carry 4 times as much load as other beasts of burden!
7
![Page 24: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/24.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Book by Gregor & Bobby!
8
8
![Page 25: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/25.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Agenda
What is Apache Camel EIP examples Some cool features of Camel Riding tips of camel Q and A
9
9
![Page 26: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/26.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Message Routing
10
10
![Page 27: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/27.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Message Routing in EIP
11
11
![Page 28: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/28.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Simple Routing
12
12
![Page 29: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/29.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Simple Routing
12
from("file:src/data?noop=true"). to("jms:queue:myqueue");
12
![Page 30: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/30.jpg)
© 2009 Progress Software Corporation. All rights reserved.
More Simple Routing
13
13
![Page 31: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/31.jpg)
© 2009 Progress Software Corporation. All rights reserved.
More Simple Routing
13
from("rmi://localhost:1099/patch/to/service"). to("netty:tcp://remotehost:1234");
13
![Page 32: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/32.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Camel Components
14
http://camel.apache.org/components.html
14
![Page 33: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/33.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Pipeline
15
15
![Page 34: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/34.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Pipeline
15
from("EndpointA"). pipleline("EndpointB", "EndpointQ", "EndpointR");
15
![Page 35: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/35.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Multicast Routing
16
16
![Page 36: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/36.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Multicast Routing
16
from("file:src/data?noop=true"). multicast("ibatis://xxx", "sftp://xxx", "smtp://xxx");
16
![Page 37: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/37.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Some examples of the EIP implementation
17
17
![Page 38: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/38.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Message Filter
18
18
![Page 39: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/39.jpg)
© 2009 Progress Software Corporation. All rights reserved.
<camelContext xmlns="http://camle.apache.org/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
Message Filter
from("activemq:topic:Quotes). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes");
19
19
![Page 40: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/40.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Language Support For Message Processing
• BeanShell
• Javascript
• Groovy
• Python
• PHP
• Ruby
• JSP EL
• OGNL
• SQL
• Xpath
• XQuery
• Simple
20
20
![Page 41: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/41.jpg)
© 2009 Progress Software Corporation. All rights reserved.
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
</beans>
Message Filter : Spring XML
21
21
![Page 42: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/42.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Message Filter : Java Complete
package com.acme.quotes;
import org.apache.camel.builder.RouteBuilder;
public class MyRouteBuilder extends RouteBuilder { public void configure() {
// forward widget quotes to MQSeries from("activemq:topic:Quotes). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes"); }}
22
22
![Page 43: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/43.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Content Base Router
from("activemq:NewOrders”). choice().when("/quote/product = ‘widget’"). to("activemq:Orders.Widgets"). choice().when("/quote/product = ‘gadget’"). to("activemq:Orders.Gadgets"). otherwise().to("activemq:Orders.Bad");
23
23
![Page 44: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/44.jpg)
© 2009 Progress Software Corporation. All rights reserved.
<camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq:NewOrders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:Orders.Widgets"/> </when> <when> <xpath>/order/product = 'gadget'</xpath> <to uri="activemq:Orders.Gadgets"/> </when> <otherwise> <to uri="activemq:Orders.Bad"/> </otherwise> </choice> </route> </camelContext>
Content Based Router
24
24
![Page 45: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/45.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Agenda
What is Apache Camel EIP examples Some cool features of Camel Riding tips of camel Q and A
25
25
![Page 46: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/46.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Some Cool features of Camel
Routing and mediation engine Domain-specific language Extensive component library Beans Type Conversion Data Format Test tools Maven tools ...
26
26
![Page 47: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/47.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Beans
27
Powerful bean integration• Adapt to you beans• EIP as @annotations
– @Produce– @Consumer– @RecipientList– @RoutingSlip
27
![Page 48: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/48.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Bean as a Message Translator
28
© 2009 Progress Software Corporation
Whats included in the box?
! Bean as Message Translator
49
Tuesday, June 8, 2010
28
![Page 49: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/49.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Bean as a Message Translator
from("activemq:Incoming”). beanRef("myBeanName"). to("activemq:Outgoing");
28
© 2009 Progress Software Corporation
Whats included in the box?
! Bean as Message Translator
49
Tuesday, June 8, 2010
28
![Page 50: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/50.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Bean as a Message Translator
from("activemq:Incoming”). beanRef("myBeanName"). to("activemq:Outgoing");
28
© 2009 Progress Software Corporation
Whats included in the box?
! Bean as Message Translator
49
Tuesday, June 8, 2010
public class Foo {
public void someMethod(String name) { ... }}
28
![Page 51: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/51.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Bean as a Message Translator
from("activemq:Incoming”). beanRef("myBeanName"). to("activemq:Outgoing");
28
© 2009 Progress Software Corporation
Whats included in the box?
! Bean as Message Translator
49
Tuesday, June 8, 2010
public class Foo {
public void someMethod(String name) { ... }}
28
![Page 52: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/52.jpg)
© 2009 Progress Software Corporation. All rights reserved.
public class Foo {
public void onCheese( @XPath("/foo/bar") String name, @Header("JMSCorrelationID") String id) { ... }}
Binding Method Arguments
29
29
![Page 53: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/53.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Sending the message
30
public class MyCoolBean {
@Produce(uri = "log:foo") protected ProducerTemplate producer;
public void sendMsg() { producer.sendBody("Hello World"); }
}
30
![Page 54: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/54.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Consume the message and EIP annotation
31
public class RouterBean {
@Consume(uri = "direct:start") @RecipientList public String[] route(String body) { return new String[]{"mock:a", "mock:b"}; }}
31
![Page 55: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/55.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Type Conversion
32
32
![Page 56: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/56.jpg)
© 2009 Progress Software Corporation. All rights reserved.
package com.acme.foo.converters;
import org.apache.camel.Converter;import java.io.*;
@Converterpublic class IOConverter {
@Converter public static InputStream toInputStream(File file) throws FileNotFoundException { return new BufferedInputStream(new FileInputStream(file)); }}
Type Conversion
# META-INF/services/org/apache/camel/TypeConverter
com.acme.foo.converters
33
33
![Page 57: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/57.jpg)
© 2009 Progress Software Corporation. All rights reserved.
from("direct:start").process(new Processor(){
public void process(Exchange exchange) { Message in = exchange.getIn();
in.setBody(in.getBody(InputStream.class));
}
}).to("mock:result");
Type Conversion
34
from("direct:start").convertBodyTo(InputStream.class).to("mock:result");
34
![Page 58: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/58.jpg)
© 2009 Progress Software Corporation. All rights reserved.
DataFormat
Camel has 18 Data Formats
35
bindy protobufcastor serialization
csv soapcrypto tidy markup
flatpack xml beansgzip xml securityhl7 xstreamjaxb zipjson dozer
35
![Page 59: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/59.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Data Format
from("activemq:QueueWithJavaObjects). marshal().jaxb(). to("mqseries:QueueWithXmlMessages");
from("activemq:QueueWithXmlMessages). unmarshal().jaxb(). to("mqseries:QueueWithJavaObjects");
36
36
![Page 60: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/60.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Test kit
Mock Endpoint• You can use it check if the message is processed rightly• jMock like API, declarative expectations • The expectations can be asserted in a test case
Test• JUnit based (3.x, 4.x)• Supports Spring• Easy to test• Quick prototyping
37
37
![Page 61: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/61.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Test support
38
@ContextConfigurationpublic class ProduceTemplateTest extends AbstractJUnit38SpringContextTests { @Autowired protected ProducerTemplate producer; @EndpointInject(uri = "mock:result") protected MockEndpoint result;
public void testProducerTemplate() throws Exception { result.expectedBodiesReceived("hello"); // lets send a message producer.sendBody("direct:start", "hello"); result.assertIsSatisfied(); }}
38
![Page 62: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/62.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Test support
38
@ContextConfigurationpublic class ProduceTemplateTest extends AbstractJUnit38SpringContextTests { @Autowired protected ProducerTemplate producer; @EndpointInject(uri = "mock:result") protected MockEndpoint result;
public void testProducerTemplate() throws Exception { result.expectedBodiesReceived("hello"); // lets send a message producer.sendBody("direct:start", "hello"); result.assertIsSatisfied(); }}
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"> <template id="camelTemplate" /> <route> <from uri="direct:start"/> <to uri="mock:result"/> </route> </camelContext>
38
![Page 63: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/63.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Maven tooling
Maven Archetypes to create new projects
Maven goals to run the project• mvn camel:run
39
mvn archetype:generate \ -DarchetypeGroupId=org.apache.camel.archetypes \ -DarchetypeArtifactId=camel-archetype-java \ -DarchetypeVersion=2.4.0
39
![Page 64: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/64.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Agenda
What is Apache Camel EIP examples Some cool features of Camel Riding tips of camel Q and A
40
40
![Page 65: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/65.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Riding tips of camel
41
41
![Page 66: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/66.jpg)
© 2009 Progress Software Corporation. All rights reserved.
CamelContext context = new DefaultCamelContext();context.addRoutes(new MyRouteBuilder());context.start();
Running Camel
42
42
![Page 67: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/67.jpg)
© 2009 Progress Software Corporation. All rights reserved.
CamelContext context = new DefaultCamelContext();context.addRoutes(new MyRouteBuilder());context.start();
Running Camel
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<from to="mock:result"/>
</route>
</camelContext>
42
42
![Page 68: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/68.jpg)
© 2009 Progress Software Corporation. All rights reserved.
CamelContext context = new DefaultCamelContext();context.addRoutes(new MyRouteBuilder());context.start();
Running Camel
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<from to="mock:result"/>
</route>
</camelContext>
42
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<package>com.exaple.your.package</package>
</camelContext>
42
![Page 69: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/69.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Camel Riding from Java
•/META-INF/spring/camelContext.xml
•set the CLASSPATH
•java org.apache.camel.spring.Main
43
43
![Page 70: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/70.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Maven Tooling
<project>... <build> <plugins> <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
mvn camel:run
44
44
![Page 71: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/71.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Running Camel
Lightweight • You can use it as Java library
Embeddable• You can deploy it in most of containers
Know Deployment Option• Standalone Java Application• Web Application• J2EE Application• JBI Container• OSGi• Google App Engine• Java Web Start• Spring Application
45
45
![Page 72: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/72.jpg)
© 2009 Progress Software Corporation. All rights reserved.
How camel do this routing work ?
http://activemq.apache.org/camel/architecture.html46
46
![Page 73: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/73.jpg)
© 2009 Progress Software Corporation. All rights reserved.
How to write your own component?
Using the Maven Archetypes to create the project• camel-archetype-component
Component • The Endpoint Factory
Endpoint• ScheduledPollEndpoint• DefaultEndpoint• ResourceEndpoint
Consumer Producer
47
47
![Page 74: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/74.jpg)
© 2009 Progress Software Corporation. All rights reserved.
How to write your own routing rule in Camel
•What's the magic of from, to, choice ......
• /camel-core/src/main/java/org/apache/camel/model
•Implementing it in DSL way
• Defining the type class that you want
•Implementing it in a Spring configuration way
• Adding the annotation for JAXB consuming
48
48
![Page 75: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/75.jpg)
© 2009 Progress Software Corporation. All rights reserved.
Q and A
49
Where do I get more information?• Camel website: http://camel.apache.org• Fuse website: http://fusesource.com• Camel in Action book: http://manning.com/ibsen
49
![Page 76: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/76.jpg)
© 2009 Progress Software Corporation. All rights reserved.50
50
![Page 77: Progress FUSE Overview](https://reader036.vdocuments.site/reader036/viewer/2022071602/613d6b55736caf36b75d1c3a/html5/thumbnails/77.jpg)
© 2009 Progress Software Corporation. All rights reserved.50
Thank You
50