Running Apache Camel in OpenESB – Part 2

In my previous post, I gave a step by step guide on running your first camel application in OpenESB. This entry is continuation to that it shows how to invoke an outbound JBI call from Camel. We will modify the same application to send message to a Glassfish’s JMS Queue instead of ActiveMQ’s queue. 1. To send a message to Glassfish’s Queue, we need a create JMS Binding WSDL Create a WSDL using the Wizard and select JMS Binding. Follow the wizard to provide a queue name, access details, etc. The WSDL should be created in CamelCompAppJBIModule1 project in default package. Choose the jbi2camel.xsd and select input element as msg:AnyMessage. Below is the types part and message part from the wsdl: <types> <xsd:schema targetNamespace="http://openesb.org/jbi2camel/CamelJBIModule1"> <xsd:import schemaLocation="jbi2camel.xsd" namespace="http://openesb.org/jbi2camel/message/CamelJBIModule1"/> </xsd:schema> </types> <message name="JMSInputMessage"> <part name="part1" element="msg:AnyMessag"/> </message> 2. Edit the jbi.xml in CamelCompAppJBIModule1 project to add the consumes element: <consumes service-name="JMSOutService" endpoint-name="jmsTestQueue_OutPort" interface-name="jms:JMSOutPortType" > </consumes> Make sure the service-name, endpoint-name, interface-name are the same ones from the newly created JMS wsdl. 3.  Edit the AppRouteBuilder.java as below:   public void configure() { String jbiJMSTestQueue = "jbi:http://j2ee.netbeans.org/wsdl/CamelJBIModule1/src/jmsTestQueue/JMSOutService/jmsTestQueue_OutPort"; //(A) String jbiURI = "jbi:http://openesb.org/jbi2camel/CamelJBIModule1/CamelJBIModule1_service/jbi2camel_endpoint"; //(B) from(jbiURI).process(new Processor() { //(C) public void process(Exchange exchng) throws Exception { Message inMessage = exchng.getIn(); String strInMsg = inMessage.getBody(String.class); System.out.println("Received in Processor : " + strInMsg); String strOutMsg = strInMsg.replace("My String", "MyReply"); exchng.getOut().setBody(strOutMsg); // (D) }}).to(jbiJMSTestQueue); //(E) } A) The variable “jbiJMSTestQueue” refers to the JMS WSDL’s endpoint. This URL is constructed by concatenating namespace, service name, port name. E). This line sends the message to the new JMS Queue. 4) Right click on Service Assembly node and “Clean” it....

Running Apache Camel in OpenESB

Introduction Apache Camel is a widely used java based integration framework. Apache camel’s strengh lies in its simple,light weight and modular approach as well as its easy-to-use implementation of Gregor Hoppe’s Enterprise Integration Patterns. It is also a very light weight framework that can also be easily embedded with other applications as a library. In Open ESB, we can utilise Camel for all its strength ranging from routing & mediation, to utilising the camel components which are missing in open esb, to integrating existing Camel applications with Open ESB. We now have a service engine called Camel SE which will act as a bridge between JBI and Camel technologies. By having a Service Engine for Apache Camel, OpenESB can utilize Apache camel by participating in message exchanges. This way we have both the technologies collaborating seamlessly. For example, HTTP BC can receive a message and can send it to Camel SE which can mediate, route, process the message, can invoke OpenESB’s JMS BC and can reply to HTTP BC. The following blog is a tutorial on how exactly we can achieve this. In this entry I will write a step by step guide on how to use the new Camel Service Engine to utilize Apache Camel in Open ESB. We will use OpenESB’s HTTP BC to receive http soap message, send it to Apache Active MQ’s queue, send it to Camel Processor and then reply to sender. You need to have both the runtime and design time modules of Camel SE to try this. Installing Runtime jar 1. Download the runtime service engine jar from here: http://hudson.openesb-dev.org:8080/hudson/job/openesb-components-git/lastSuccessfulBuild/artifact/dist/camelse.jar 2. Go to Servers...