fb
WSO2 Enterprise Integrator 2 min

WSO2 ESB 4.9 with ActiveMQ 5.13 installation

Jenny Gligorovska
Jenny Gligorovska
Integration Consultant
ActiveMQ 1
Scroll

WSO2 ESB has a good integration with ActiveMQ queueing platform.

We can have proxies that consume messages from a queue (or topic), call backend for processing or perform orchestration by calling several services and send response to a reply queue.

Environment

In this example, versions of ActiveMQ 5.13 and WSO2 ESB 4.9 are used.

In order WSO2 ESB to communicate with ActiveMQ, we need to:

  1. Copy the following client libraries from <AMQ_HOME>/lib directory to < ESB_HOME>/repository/components/lib
  2. activemq-broker-5.13.2
  3. activemq-client-5.13.2.jar
  4. geronimo-j2ee-management_1.1_spec-1.0.1
  5. geronimo-jms_1.1_spec-1.1.1
  6. hawtbuf-1.11
  1. Enable and configure JMSReceiver and JMSSender for Activemq in conf/axis2/axis2.xml

JMS_Receiver_and_JMSSender_for_Activemq.png

HTTP to JMS Dual Channel

HTTP -> JMS –orchectration– -> JMS reply

JMS  Request Reply Endpoint
The endpoint has defined reply destination

JMSRequestReply_endpoint

JMSRequestReply_endpoint.png

HTTP to JMS Request and Reply proxy

This HTTP proxy sends message to JMS queue and waits for the response from JMS Reply queue.

The message is received from HTTP forwarded to JMS queue. Out sequence waits for he message from JMS reply queue and forwards it to HTTP Response.

HTTP_JMS_RequestReply

HTTP_JMS_RequestReply.xml.png

HTTP_JMS_RequestReply_.png

JMS Request Response proxy

This Proxy has JMS transport. It receives the message, processes it and sends reply message in the reply queue. In this proxy we can orchestrate calls to other services/systems, gather results and send resulting message to the reply queue. This message will be forwarder as HTTP response ij the previous proxy, named HTTP 2 JMS Request Reply. Message is transferred from the inSequence to the outSequence with loopback mediator. With payload mediator we can construct new reply message.

JMS_ReceiverRespond.xml.png

JMS_Request_Response_proxy.jpeg

Information for receiver and reply queue is placed in the proxy as parameters.

Sending the message

In ActiveMQ web console we can see that the message is enqueued and consumed (dequeued)

ActiveMQ-1.png

HTTP to JMS Asynchronous Channel

For Asynchronous channel, we use property OUT_ONLY = true. The message is put to queue by http proxy but the response is not expected. The endpoint has no Reply queue specified.

JMS Endpoint
JMS_Endpoint.png

Http Sender to JMS queue

To test receiving JMS messages by ESB proxy, we might make helper proxy that will receive SOAP message from a web service (ex. From Soap UI) and send it to a queue.

The proxy is called HTTP_2_JMS_Send
HTTP_2_JMS_Send.png

Http_Sender_to_queue.png

SOAP Endpoint for this http proxy is http://localhost:8280/services/HTTP_2_JMS_Send

JMS Receive and Reply Proxy

jmsReceiveAndReply – This is the main proxy. It receives the message from the queue, processes it and sends reply to the reply destination.

JMSReceiveAndReply.png

JMSReceive_And_Reply_Proxy.png

Sending the message

In ActiveMQ web console we can see that the message is enqueued. (See Queue1 and Queue1Reply.)

ActiveMQ-sending_the_message.png

Also in log, we can see log messages.

Conclusion

ActiveMQ has easy and reliable integration with WSO2 ESB. Their setup is straightforward and their runtime functioning is seamless. This blog is about necessary steps and jars for integration of ActivemQ and WSO2 ESB as well as HTTP <-> JMS communication as both protocols are used in enterprise environments. Placing message into a queue can be done easily with HTTP proxy that sends a message to a JMS queue. HTTP to JMS Dual Channel synchronous communication is shown as well as asynchronous communication in the later case.

If you have any questions about this blogpost contact us via the comments section of this blog. View also our WSO2 Tutorialswebinars or white papers for more technical information. Need support? We do deliver WSO2 Product Support, WSO2 Development SupportWSO2 Operational Support and WSO2 Training Programs.

Full API lifecycle Management Selection Guide

WHITEPAPER

smartmockups l0qqucke