amqp egress connector

AMQP Egress Connector

Version: 17.07

Supported Since: 17.01

What is AMQP Egress Connector?

AMQP Egress connector can be used to send messages to AMQP destinations from the UltraESB. When using AMQP Egress Connector you can use it with a transactional AMQP Ingress Connector or with a CallbackHandler

You can either use transactional (transaction mode) or Callback Handler (confirm mode) with a specified Connection Factory
In order to use the AMQP Egress Connector, you must first select the AMQP Connector dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the AMQP Connector dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list, select the AMQP Connector dependency.
amqp egress connector 11

Out Ports

On Exception

The message will be emitted from this out port if the Egress Connector failed to process the message due to some reason

Response Processor

The message will be emitted from this out port if the Complete Flow property is disabled and the message has been sent to the AMQP destination successfully

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

AMQP Template *

Basic

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

Destination *

Basic

Name of the destination queue

Callback Handler

Advanced

Callback object to be invoked when async response received from the MQ server when a message is sent notifying its received status by the server. Users can specify their custom implementations of org.adroitlogic.x.base.trp.SendCallback class as the Callback Handler as well.

Complete Flow

Advanced

If true, the integration flow will be completed once the message has been sent to the AMQP destination. If false, the original message sent to the AMQP destination will be emitted to the Response Processor out port to continue the flow

Weight

Fail-Over

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

Sample Use Case

Prerequisite

First you need to specify a Connection Factory to connect to the AMQP Server. For this example let’s use Rabbit MQ and if you have not already installed Rabbit MQ, please follow the Installation Guide

1. Sending a message to an AMQP queue in transaction mode

In-order to use the transaction mode, you must first add the required resources in the project.xpml file. Right click on project.xpml file and from the context menu, select Resource Template as shown in below figure

amqp egress connector 1

After that from the shown dialog box, select RabbitMQ with Transaction template.

amqp egress connector 2

Next you need to specify the required parameters as shown below. It is mandatory to specify a bean prefix and for that you can specify any value. Apart from that you need to specify the host and port of the RabbitMQ server.

amqp egress connector 3

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

amqp egress connector 4

As you can see, there is one AMQP Ingress Connector with a transaction manager specified, and Channel Transacted enabled (under Transaction tab in the property pane) and within the transaction scope there are two AMQP Egress Connectors to send the message to two destination queues. After sending the message to both queues, we are closing the transaction scope and completing the integration flow with a Successful Flow End component. If you run the project, you can see that the original message has been sent to both destination queues.

Now if we add an Exceptional Flow End element after the second AMQP Egress Connector, you can see that message flow completes with an exception while the transaction scope is still active. In this case, the original message is not sent to the either of destination queues and rolled back to the source queue.