Defining An On Event Request/Reply Flow
Use a TIBCO Cloud™ Integration - Connect Request/Reply flow to use data from any TIBCO Cloud™ Integration - Connect Connection with another application, if that application can call a REST API.
Performance
Each app containing one or more Request/Reply flows is bound to a single TIBCO Cloud™ Integration - Connect agent which limits the number of requests that can be processed. In addition, you should be aware of the following restrictions when using Request/Reply:
- If the time to send a reply exceeds the default timeout of 90 seconds, a timeout error is generated.
- Request processing wait times increase as you increase the number of calls.
- When using a Connect cloud agent, on average, Request/Reply can only support 1 call every 2 seconds.
- When using a Connect on-premise agent the number of calls per second might be improved depending on the CPU and available memory on the server where the agent is installed. Performance testing in your specific environment would be required to determine the capacity of the server.
- If, over time, the application that is calling TIBCO Cloud™ Integration - Connect is exceeding the 1 call every 2 seconds limit, the response times take longer creating a backlog of messages. When the backlog reaches 100 or more, the system starts returning 429 errors for new messages and does not add them to the backlog until enough messages are processed to reduce the backlog.
- Individual message size is limited to a maximum of 20 MB.
Exceeding these limits could trigger governance thresholds causing automatic controls in TIBCO Cloud™ Integration - Connect to restrict your IP address. If you find that your IP address has been restricted, contact Support to request that the restriction be lifted. See section 9 of the TIBCO Cloud Service Terms.
Tips
- Request/Reply is meant for quick transactions using synchronous requests where a reply is needed.
- If you have more than one Request/Reply flow in an app, consider separating the flows into different apps with each app assigned to a different agent to distribute the workload.
- Consider using Message flows.
- If you are using TIBCO Cloud™ Integration, consider implementing TIBCO Flogo®.
- When configuring an application to send a request to TIBCO Cloud™ Integration - Connect, be sure to account for transient fault errors that may result in messages that are not processed. TIBCO Cloud™ Integration - Connect can be configured to send a reply to the application that sent the original request using the Build Reply and Send Reply operation Blocks. The reply can serve as a notification that the message was received. Any message that does not trigger a reply, may have been lost due to a transient fault and should be considered for retry/reprocess from the calling flow.
- The system used to send requests to TIBCO Cloud™ Integration - Connect receives errors when it can no longer contact TIBCO Cloud™ Integration - Connect. Implement error trapping and monitor your system for those errors so they can be addressed as soon as possible.
Request/Reply Example
For example, assume you have a custom application and you want that application to add new leads to a Dynamics CRM account. With a Request/Reply flow, you can:
- Design the schema for your input fields in the Wait For Request Block, such as the Name, Address, and Phone fields for the lead.
- Define the schema for the fields you want returned in the Build Reply Block. In this example it might just be a Boolean value that says whether the lead was successfully created in Dynamics CRM.
- Add the Endpoint URL generated in the Wait for Request block to the part of your source code or application that sends the leads. The code for your custom application also requires a web request body that provides values for the fields you designed in the Wait for Request block. See Request/Reply Flow Example. For more information on how to format the request body, see the JSON.org site.
- Write code in your custom application that parses the body of the web reply and retrieves any return values. See Request/Reply Flow Example. For more information on how the reply body is formatted, see the JSON.org site.
- Write code in your custom application that sends a lead again if no web reply is received from TIBCO Cloud™ Integration - Connect.
As illustrated below, the request pings the TIBCO Cloud™ Integration - Connect cloud endpoint, which is a unique URL for each flow. The flow runs and TIBCO Cloud™ Integration - Connect sends a reply to your agent with the data returned by the flow.
To use a Request/Reply flow within an On event app, you need to:
- Set up the Request/Reply flow in TIBCO Cloud™ Integration - Connect, starting with the Wait For Request Block.
- Set up your custom application to call the TIBCO Cloud™ Integration - Connect REST API. When you first save the Wait For Request Block in your flow, the Endpoint URL required by your custom application displays. You can copy the Endpoint URL and paste it to the code in your custom application.
Using Build Reply And Send Reply Blocks
For Request/Reply flows the Build Reply Block and Send Reply Block display in the Connections panel on the flow canvas. While these Blocks are optional, they may provide useful information.
- Build Reply — Defines the data fields that this flow returns to the application that sent the inbound request. The size of the reply message is limited to 1MB.
- Send Reply — Causes the Reply to be sent back to the requester. Similar to the Map Exit block, use this block to exit out of the flow early or to trigger an error message. While you can use Send Reply to change the error handling for this flow, Send Reply is optional. When Send Reply is used, it has a 90 second window of time to be sent before the reply times out with a Gateway Timeout error.
Creating Flows
When you open a flow the Connections panel and workspace display. The Connections panel contains all of the blocks required to easily create flows used to integrate your source data into one or more target datastores. To build your flow, move the blocks into the workspace.
Each time you save your flow a separate revision of the flow is stored. Before saving, enter a comment in the Comment field at the bottom of the workspace to associate a comment with the new revision. You can go back to a prior revision from the Revisions dialog. See Flow Revisions for additional information.
Selecting Connections
Each Connection in a flow can be used for both Source and Target operations based on what the Connector and the associated datastore support. For example, if you have a Salesforce Connection and you use a Query block for that Connection in the flow, the Query is a Source operation, therefore, Salesforce is the Source for that block. If you use a Create block for the Salesforce Connection in the flow, Create is a Target operation, and Salesforce is the Target for that block.
Connections are sorted based on the order in which they were added to the flow. The color of the blocks associated with a Connection is determined by the order of the Connections. Control blocks are always light purple, the first Connection Blocks are always orange, and Blocks for the second Connection are yellow, and so on up to eleven Connections.
TIBCO Cloud™ Integration - Connect supports multiple target datastores in Integration flows. You can integrate data from one source into multiple targets. For example, while integrating your Microsoft Dynamics GP data into Salesforce, you can also send data from the same run to a CSV Text file for reporting purposes. Add Connections to a flow to connect to one or more target datastores.
The first step is to select or create Connections in the Connections panel on the left side of the flow. From the Connections panel, you can either:
- Select Add Connection and select an existing Connection from the Connection dialog.
- Select Add Connection and select Create a New Connection in the Connection dialog.
- After selecting a Connection, you can use the Gear menu to do the following:
- Edit — Make changes to the selected Connection. See Editing Connections.
- Reassign Connections — Change a Connection within a flow without reconfiguring each block that calls that Connection.
- Reset Metadata — Update the metadata for this Connection.
See Resetting Metadata. Note: Metadata for Text Connections cannot be reset here. See Resetting Metadata for Text Connections.
- Metadata Status — View a list of the most recent set of metadata requests and the request status for this Connection. See Metadata Status.
- Remove — Delete the Connection. Connections can only be removed if they are not used in the flow.
As soon as a valid Connection is selected, all of the blocks supported by the Connection display in the Connection panel.
Starting A Flow
After you select your Connections, you can begin to create a flow. A flow is a visual representation of the instructions needed to integrate your data. For Message flows, the flow must start with a Wait For Request Block.
- From the Connections panel, select the Wait For Request block associated with the Connection you want to use as a data source and drag it to the workspace.
Note: As you drag and drop blocks, the top border always changes color. If the color of the block is transparent, you have not attached it correctly to the previous block and the flow does not run.
When you first drag blocks over, they often display an error in the corner. This is expected because the block is missing important configuration information, such as the entity you want to use.
- Select the Wait For Request block.
- Select the Request link in the Properties panel to open the Wait For Request Block Properties.
- Enter your input fields as described in Wait For Request Block.
- When you are done configuring request schema, save your flow.
Note: After saving the flow the first time, TIBCO Cloud™ Integration - Connect generates a unique Endpoint URL which displays on the Block Properties — General tab of the Wait For Request block. This may take a few minutes.
You must copy and paste the Endpoint URL into the code in the application sending the request to TIBCO Cloud™ Integration - Connect.
You can also use the Endpoint URL to generate an OAS document. See Generate An OAS Document For Request/Reply Flows.
Endpoint URL
- Continue adding blocks to your flow. Unlike a regular flow, the For Each Result block is not required or available.
As you build your flow, keep in mind that you only define the processing for one record at a time. If a request message contains multiple records, your flow runs once for each record.
Adding More Blocks
- Once you have added the Wait for Request block, you can drag and drop the blocks you need from the Connections panel.
- As you add blocks to your flow, use the links in the Properties panel to access and configure the Block Properties dialog for each block. The information available on the Properties dialog depends on the specific block.
Note: Fields and entities available in one block can access the values returned in preceding blocks.
- Select Apply to save the flow in its current state. You must save the flow before debugging. See Debugging Flows.
- Continue to add blocks as needed. See Working With Blocks.
Additional Steps
Configure your source datastore or application code to call the Endpoint URL shown on the General tab of the Wait For Request block.
Set Security Rules
From the Security dialog under Environment & Tools > Security Settings, specify the security rules for the On event apps in this Organization.
- 54.204.16.213
- 54.83.47.195
- 23.23.251.57