string payload setter

String Payload Setter

Version: 17.07

Supported Since: 17.01

What is a String Payload Setter?

String Payload Setter processing element can be used to set the message payload from a pre-configured string. This string can contain dynamic content which should be able to derive from message properties, scope variables, transport headers, message id, current timestamp and current payload.

In order to use this processing element, you must first select the Payload Manipulation 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 Payload Manipulation dependency.

string payload outports

Out Ports

Next

Message will be emitted from this port after setting the extract value from the XPath as the configured scope variable

On Exception

The message context will be sent to this outport if any exception occurred while extracting the provided XPath

Parameters

String Payload *

Basic

String value to be set as the current payload of the message. This can be set dynamically as well, using any combination of @{message.headers.<name>}, @{message.properties.<name>}, @{variable.<name>}, @{current.timestamp.<timestamp_format>} and @{message.id}

Sample Use Case

In the following use case, the requirement is to create a web service to accept HTTP requests which expect large batch data files as the asynchronous response. For the request messages this web service should respond with a acknowledgement message to mention that it accepted the request and asynchronous respond will be sent in a separate HTTP call. For the generation of the asynchronous response, web service should put the request message to a JMS queue and there will be another entity which will fetch the JMS message and send the asynchronous response to the asynchronous URL which will be received the Async_URL transport header of the request message.

Prerequisite

In order to implement above use case you must first select following dependencies when you are creating an empty Ultra project

  • HTTP NIO Connector and Spring JMS Connector from the connector list.

  • Regular Payload Setter Processors and Flow Control processing element from the processor list.

If you have already created a project, you can add above dependencies via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies

Implementation

To implement above use case, first let’s create our integration flow named “integrate-for-asynchronous-batch-data". Then add an NIO HTTP Ingress Connector and configure the request receiving service path and port.

Next processing element should be the Clone Message Processing Element to clone the received message and send one message to the JMS queue and other message as the response message to the original HTTP request.

Then String Payload Setter processing element should be added to set the payload from a string. This string should contain the asynchronous URL which should be received as the Async_URL transport header of the original request. For that, String Payload Setter should be configured as below,

string payload setter 1

As the final processing element, JMS Egress Connector should be added to send the original request message to the JMS queue.

With all above elements, complete integration flow would be like this,

string payload setter 2

Now run your integration flow and send a request message to the configured request URL to test your integration flow. Once you send a request with Async_URL transport header, as the response you should get the configured string content with the asynchronous URL you have sent as the Async_URL transport header.

In this topic
In this topic
Contact Us