Version: 17.07
Supported Since: 17.01.2
The Multi Clone Processor can be used to get multiple clones of a full message context (with a clone of its enclosed message), and send the cloned message contexts in multiple different processing branches in order to use Multi Aggregate Processor later in the flow to aggregate those cloned messages and create a single message context to proceed through the rest of the flow.
A Multi Clone Processor is always expected to use with a Multi Aggregator later in the flow. If there is no multi-aggregator in the flow to aggregate cloned branches, then the flow will be simply completed through the timeout-processor out port when the Aggregator timeout has passed. |
While some of the attributes of the cloned contexts will be different from the original context, some attributes will be shared. Please refer the following tables on how the important message context attributes and message attributes are been handled in cloning. |
Message Context Attributes
Attribute | Cloned Contexts |
---|---|
Context ID |
A new ID will be generated for each clone |
Message |
Original message will be cloned with payload for each clone |
Exchange pattern |
Can be defined as a parameter in this processor configuration |
Scopes |
Current scopes of the original will be inherited |
Context properties |
Primitive property values will be cloned. If the property value is a complex object, same object will be referred by both contexts |
Context Closeables |
Closeables of the original context will neither be inherited nor cloned |
Transactional properties |
Same set of transactional properties will be shared by both contexts |
Message Attributes
Attribute | Cloned Contexts |
---|---|
Message ID |
A new ID will be generated |
Payload |
Payload of the original message will be cloned. Cloning mechanism will depend on the type of the payload. |
Transport headers |
Transport headers with primitive types will be cloned. If the header value is a complex object, same object will be referred by both messages. |
Message properties |
Message properties with primitive types will be cloned. If the property value is a complex object, same object will be referred by both messages. |
Attachments |
Attachments of the current message will be cloned |
Destination URI |
Will be same as the current value of original message |
Content type/Request |
content type Will be same as the current value of original message |
Response Code |
Will be same as the current value of original message |
A Multi Aggregate Processor can be used to aggregate several messages coming through multiple branches of a flow which has been cloned using a Multi Clone Processor. Multi Aggregate Processor is built in a way that the aggregation logic can be externalized. A user can simply extend the Multi Aggregate Processing element and code the aggregation logic in a separate user invented processing element using the provided API methods.
By default the Multi Aggregator shipped with the UltraStudio will be aggregating the all messages payloads in to a single message by the cloned order. |
In order to use this processing element, you must first select the Flow Control dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Flow Control dependency. |
Output |
The Cloned message contexts will be sent through this port, multiple processing elements and/or connectors can be connected to this outport |
Timeout Processor |
Partially aggregated message context or message context with an error message will be sent through this port, depending on whether at least one message has reach to the aggregator or non of the messages reach to the aggregator by the time of the event of a timeout |
On Exception |
The message context will be sent to this outport if any exception occurred while cloning procedure |
Exchange Pattern |
Basic |
Defines the exchange pattern to be set for the cloned message contexts. If Keep Original option is selected, the exchange pattern of the original message context will be set to the cloned message context as well. |
Aggregation Timeout * |
Basic |
Defines the timeout that the aggregator should stop waiting for cloned paths to be completed. The timeout between this multi clone and a possible aggregation of the cloned message in the flow in milliseconds. Defaults to 10000 millis. Setting 0 or minus value will disable the timeout functionality |
Output |
The Original message context with Aggregated message set to it as the message will be sent through this port. |
Delayed Message Processor |
Any message reached to Aggregator Processing element after a aggregation timeout happened will be forwarded to this outport |
On Exception |
The message context will be sent to this outport if any exception occurred while aggregation procedure |
In the following use case, the requirement is to receive a XML message and send it to two different HTTP endpoints and receive their responses. Then send back the aggregated response to the original HTTP request by aggregating the two responses received from the two HTTP endpoints. One HTTP endpoint expects JSON type payload while the other one expects a XML message.
To achieve the above requirement, the message context (containing XML message) is first handed over to a Multi Clone Processor, which will create two cloned message contexts and send those through two paths. The first path is connected to XML to JSON transformer processor and after that sent it to an external endpoint using a HTTP Egress connector. Second path is connected directly to another HTTP Egress connector and the response Outport is connected with a Multi Aggregator Processor along with the out port of aforementioned first HTTP Egress connector’s response path though a JSON to XML transformer processor.
Multi Aggregator Processor waits for the completion of both paths and try to aggregate the payloads. However, if any of cloned paths were not able to complete within the Aggregate Timeout, The flow will complete through the Timeout Processor Outport of Multi Clone Processor (which is connected to an Exceptional Flow End processing element here). At the time of a timeout event occur, if only few of the cloned path of many had completed, those will be aggregated and forwarded to timeout processor using the aggregation logic. A user can also configure the Timeout aggregation logic as well by extending the Default Multi Aggregator processing element.