Version: 17.01
Supported Since: 17.01
The Clone Message Processor can be used to get a clone of a message context (with a clone of its enclosed message), and send the original and cloned message contexts in 2 different processing branches.
While some of the attributes of the cloned context will be different from the original context, some attributes will be shared by both. Please refer the following tables on how the important message context attributes and message attributes are been handled in cloning. |
Message Context Attributes
Attribute | Clone with message | Clone without message | Clone without payload |
---|---|---|---|
Context ID |
A new ID will be generated |
||
Message |
Original message will be cloned with payload |
Message will be |
Original message will be cloned without payload |
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 | Clone with message | Clone without payload | Clone without message |
---|---|---|---|
Message ID |
A new ID will be generated |
Message is not cloned under this clone type |
|
Payload |
Payload of the original message will be cloned. Cloning mechanism will depend on the type of the payload. |
Payload will be empty |
|
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 |
Cloned message will not have any attachments |
|
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 |
In the following use case, the requirement is to read a CSV file content and perform the following operations.
Transform the CSV payload to XML and then send to a JMS queue
Transform CSV payload to JSON and then save to a file
To achieve the above requirement, the message context (containing CSV message) provided by File Ingress Connector is first handed over to a Clone Message Processor, which will create a clone of the message context. Since the Clone Type is set to With full message, the cloned message context will have a clone of the CSV payload as well.
Then the original message context is sent to a CSV to XML Transformer, which will transform the CSV payload to XML. After that it is sent to a JMS Egress Connector, which will send the message to the configured JMS queue.
Similarly the cloned message context is sent to a CSV to JSON Transformer, which will transform the CSV payload to JSON. After that it is sent to a File Egress Connector, which will save the message as a file to the configured location.
Since the Completion Procedure is set as On completion of both, the main thread waits for both of the above operations to be completed and then returns.
Original Message |
The original message context received will be sent to this outport |
Cloned Message |
The cloned message context will be sent to this outport |
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 context. If Keep Original option is selected, the exchange pattern of the original message context will be set to the cloned message context as well. |
Clone Type * |
Basic |
Defines the type of cloning to be used. Please refer the above tables for the comparison between each cloning type. |
Flow Result Procedure * |
Basic |
This parameter specifies how the final result of the complete message flow should be derived from the results of original message and the cloned message branches. * On result of both - In this case, the final result of the message flow is considered to be * Only on result of Original - In this case, the final result of the message flow is considered to be equal to the result of the original message branch, irrespective of the result of the cloned message branch. * Only on result of Clone - In this case, the final result of the message flow is considered to be equal to the result of the cloned message branch, irrespective of the result of the original message branch. * On result of any - In this case, the final result of the message flow is considered to be |