Digital platforms
Prasad Narasimhan
Explorer in Microservices, Cloud, Kubernetes and its related technologies
Usage of Camel in implementing EAI approach
As we were discussing on many of the EAI patterns
Pipes and Filters is one of the processing technique of complex processing on a message while maintaining independence and Flexibility. Camel uses Pipeline in the Blueprint.xml to connect multiple routes this can be implemented using the JBoss fuse such as IDE or the Spring Integration.
Message Router is one of the mode to decouple individual processing steps so that messages can be passed to different filters depending on a set of conditions using the choice command.
<choice>
<when>
<xpath>/person/company = 'XYZ'</xpath>
<to uri="mock:result1"/>
</when>
<otherwise>
<log message="Other message"/>
<to uri="mock:result2"/>
</otherwise>
</choice>
How do we route message to a list of statically or dynamically specified recipients
<multicast stopOnException="true">
<to uri="direct:server1"/>
<to uri="direct:server2"/>
</multicast>
How we can process a message if it contains multiple elements each of which may need to be processed in a different way.
<split id="EmployeeTypeSplitter" parallelProcessing="true"
timeout="0">
<xpath>/employees/employee</xpath>
<setHeader headerName="EmployeeType"
id="SetEmployeeTypeFileName">
<xpath
resultType="java.lang.String">/employee/@employeetype</xpath>
</setHeader>
<to
uri="file:xyz/output?fileName=${in.header.EmployeeType}-
${date:now:yyyyMMddHHmmssSSSSS}.xml"/>
</split>
Aggregator - combine the results of messages but related messages can be processed as a whole
<aggregate strategyRef="myAggregatorStrategy"
eagerCheckCompletion="true">
<correlationExpression>
<constant>true</constant>
</correlationExpression>
<completionTimeout>
<constant>5000</constant>
</completionTimeout>
<to
uri="file:xyz/output?fileName=aggregator.txt" />
</aggregate>
These are examples of some of the patterns how its implemented in Camel , we can use Normalizer and other patterns. This can be referred from the camel site