jms egress connector

JMS Egress Connector

Version: 17.01

Supported Since: 17.01

What is Spring JMS Egress Connector?

Spring JMS Egress Connector can be used to send messages to JMS destinations from UltraESB. At the moment, UltraESB supports JMS specification 1.0.2+ and if you are using any proprietary JMS server it MUST be compatible with the 1.0.2+ specification.

Sample Use Case

Prerequisite

In order to use the JMS Egress Connector you must first select the “Spring JMS” dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the “Spring JMS” dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list, select the “Spring JMS” dependency.

After that you need to specify a JMS Template to send messages to the destination. For this example let’s use ActiveMQ and if you have not already installed ActiveMQ please follow the installation guide.

Now if you open the project.xpml file in your project under Design view, there is a dropdown button names “Custom Template” and under that you will see an item named “ActiveMQ JMS” as shown below.

jms ingress connector 1

Select that and fill the required parameters and click save button. Now Ultra Studio will add all the resource beans required to handle JMS messages with minimum configuration to the project.xpml file.

jms ingress connector 2
1. Sending a message to a JMS queue

In-order to send a message to a destination queue, first we need to inject a message to the UltraESB and for that let’s first add a JMS Ingress Connector to obtain a message into the UltraESB. If you are not familiar with JMS Ingress Connector, refer JMS Ingress Connector.

Next add a JMS Egress Connector and specify the Active MQ JMS Template and the destination queue name as shown below

jms egress connector 1

After that connect JMS Ingress/Egress connectors as shown below.

jms egress connector 2

Now after creating a run configuration [link to creating a run configuration] and running the project, you will be able to see that the message has been obtained from the remote JMS queue and sent it to the destination queue.

2. Sending a message to a JMS queue transactionally

In this example let’s see how we can send a message obtained from a remote JMS queue can be sent to multiple destination queues as an atomic operation through a transaction. First create the flow as shown below

jms egress connector 3

As you can see, there is one JMS Ingress Connector with a transaction manager specified and within the transaction scope there are two JMS Egress Connectors to sent the message to two destination queues after cloning the original message. If you run the project, you can see that the original message has been sent to both destination queues.

Refer Clone Message Processor to know more about the message cloning. But as for this case, specify Keep Original as the "Exchange Pattern" and On Completion of Both as the "Completion Procedure"

Now if we add an “Exceptional Flow End” element to the Clone Message as shown below and run the project, you will see that the message does not goes to the destination and rollback to the original source queue.

jms egress connector 4

This happens because when we specify the transaction manager to the JMS Ingress Connector and include the egress connectors within the same transaction scope, all JMS queueing/de-queuing operations are bounded with a singe transaction and if the message flow fails within the transaction scope, the transaction will be rolledback.

It should be noted that for a for the JMS Ingress/Egress connectors to be bound by a single transaction, the JMS template MUST use the same JMS Connection Factory used by the Ingress Connector

Out Ports

On Exception

The message will be sent to this outport if the Egress Connector failed to process the message due to some reason

Side Ports

Connector Operation

This port is used to connect operational elements to the Egress Connector. By-default, user does not have to connect any operational element and the default connector operation will be used.

Parameters

* marked fields are mandatory

JMS Template *

Basic

The org.springframework.jms.core.JmsTemplate instance to be used in-order to send messages to destination queue.

JMS Destination *

Basic

Name of the destination queue

Meta-Info Populator

Advanced

An instance of org.adroitlogic.x.transport.jms.util.MetaInfoPopulator to allow custom meta information to be populated into the message

Weight

Fail-Over

Weight for the Egress Connector if Egress Load Balancer element is used with Weighted/Weighted with Failover algorithm is used.

In this topic
In this topic
Contact Us