Why Apache Camel?
- Apache Camel allows you to integrate your business components using Enterprise Integration patterns.
Use Case
- You need to process purchase orders from your web site or from your business partners.
- You like to acknowledge the order first
- You like to apply some business rules to the order
- You like to send the purchase order to your accounting department and shipping departments.

Apache Camel Code
public class OrderProcessingRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
JaxbDataFormat pubJaxb = new JaxbDataFormat();
pubJaxb.setContextPath("camel");
from("jms:incomingOrders")
.to("validator:xsd/cameleex1.xsd")
.wireTap("direct:mainprocessing")
.beanRef("orderProcessingBean", "acknowledge").inOut();
from("direct:mainprocessing")
.unmarshal(pubJaxb).beanRef("orderProcessingBean", "execute")
.marshal(pubJaxb).convertBodyTo(String.class).multicast()
.parallelProcessing().to("jms:shipping", "jms:accounting");
}
- OrderProcessingRoute listens to messages in the JMS queue
- OrderProcessingRoute validates the incoming message
- OrderProcessingRoute acknowledge the request using Spring bean.
- OrderProcessingRoute applies business rules using Spring bean.
- OrderProcessingRoute send the message to accounting department and shipping departments.
- Done