run icon

Project-X Runtime Architecture

Version: 17.07

Receiving a message through a transport listener

As mentioned in the previous sections, an Integration Flow in Project-X receives messages through Ingress Connectors. When an Ingress Connector is registered by an Integration Flow, a transport listener that implements the intended transport protocol of that connector is initialized and started by Project-X. Depending on their configuration similarities, multiple ingress connectors of an Ultra Project can share the same underlying transport listener to receive messages.

Once a message is received by a transport listener, it creates a Message object with the received data, setting the payload, headers and any other related information. Then this message object is enclosed in a Message Context object which bears the contextual information regarding the message.

If the transport listener itself can decide which one of its registered Ingress Connectors should handle this message, that information also will be included into the message context.

After the Message Context is built, transport listener will handover it to the Message Receiver, with two consumer methods, one to be invoked on the successful completion of the message flow and other to be invoked on the failure of the message flow. In addition to these, In-Out type transport listeners will provide another consumer method to be invoked on the submission of a response.

listener flow

Message Receiver

Once a Message Context is received from a transport listener to the Message Receiver, first the receiver will check whether an Ingress Connector has been already selected by the transport listener to handle the message. If not, the message receiver will select the suitable Ingress Connector based on the received message.

In case if a suitable Ingress Connector could not be found, a InvalidReceiveException will be thrown by the Message Receiver.

Then if the message is a request-response type message, the Message Receiver will set a Response Timeout value to the Message Context. If the selected Ingress Connector has a Response Timeout value specified, it will be used or if not, the global Response Timeout value (which is specified in the org.adroitlogic.x.core.IntegrationPlatform bean on the conf/server.xml file) will be used.

After the Response Timeout of a Message Context is elapsed, it will be considered as expired and no longer valid for processing.

Finally the Message Receiver will register the provided consumer methods with the Message Context, set few other internally used properties and handover the message context (with the selected Ingress Connector) to the Integration Platform.

receiver flow

Integration Platform

When the Message Receiver provided a Message Context to the Integration Platform, it will set the information such as the current scope parameters, exchange pattern, transactional information, etc and dispatch the Message Context to the previously selected Ingress Connector through the customized executor service of Project-X which is known as the Scale-First Executor Service.

platform flow

Processing a Message Context by the Ingress Connector

The selected Ingress Connector receives the Message Context through Scale-First Executor service and after performing any connector specific operations, the Message Context will be passed to the processing element connected to the "Processor" outport of the Ingress Connector which will be the first processing element of the Integration Flow.

ingress flow

Processing a Message Context by Processors

After the Ingress Connector, the Message Context is sent through a series of Processing Elements. Each of these Processing Elements will perform a specific processing operation on the Message Context and handover the resulting Message Context to one or more processing elements.

Before executing any processing, every Processing Element will check whether the received Message Context is not expired and not marked as completed. If any one of these conditions failed, the processing of that Message Context will be aborted there onwards. In the event of expiration, the Message Context will be marked as Exceptionally Completed with a Timeout Exception.

Completing a Message Context with Flow End Processing Elements

There are two special processing elements as Successful Flow End element and Exceptional Flow End element, that can be used as the final processing element of a flow. The Successful Flow End element will mark a message context as "Successfully Completed" while the Exceptional Flow End element will mark a message context as "Exceptionally Completed" with an Integration Runtime Exception.

processor flow

Sending-out the Message by an Egress Connector

An Egress Connector can be used to send the processed Message to an external system or endpoint. An Egress Connector receives a Message Context just as a regular processing element and first validates that the Message Context is neither expired nor already completed. Then if there is a Connector Operation element connected, the Message Context will be handed over to it and the resulting Message Context will be sent-out to the desired endpoint using the underlying transport sender.

But depending on whether it is one-directional or bi-directional, this sending-out behaviour of an Egress Connector varies.

One-directional Egress Connectors

After the Connector Operation is finished its processing, a One-directional Egress Connector such as SFTP, File or JMS, will send-out the resulting Message Context to the desired endpoint using the underlying transport sender. Once the sending process is completed, the Egress Connector will end the message flow by marking the Message Context as either "Successfully Completed" or "Exceptionally Completed", based on the result of the sending-out process.

1 egress flow

Bi-directional Egress Connectors

After the Connector Operation is finished its processing, a Bi-directional Egress Connector such as HTTP or FIX, will set an Egress Timeout value to the Message Context. If the Egress Connector itself has a Egress Timeout value specified, it will be used or the global Egress Timeout value (which is specified in the org.adroitlogic.x.core.IntegrationPlatform bean on the conf/server.xml file) will be used otherwise. Then the Message Context will be sent-out to the desired endpoint using the underlying transport sender.

If the sending-out process is failed due to some reason, the Egress Connector will end the message flow by marking the Message Context as "Exceptionally Completed". If the sending-out process is successful, the Bi-directional Egress Connector will wait for a response message from the external endpoint to which the message was sent. If a response is received before the Egress Timeout has been elapsed, that response will be processed and handed-over to the processing element connected to the "Response Processor" outport of the Egress Connector which will be the first processing element of the response path.

If a response has not been received within the Egress Timeout, the Bi-directional Egress Connector will end the message flow by marking the Message Context as "Exceptionally Completed" with a Timeout Exception.
2 egress flow

Sending-out a Response by an Ingress Connector

If the Ingress Connector that received the message is a request-response type Ingress Connector, a response can be sent by connecting the last processing element of the response path to the "Input" port of the Ingress Connector. Then the current content of the message will be sent as the response content and the message flow will be completed successfully.