What are Request-Reply Maps and When Should I Use Them?

By:
Last updated:
1:00pm Jun 27, 2019

Most integrations start with a query to a source system that returns some records for processing. This is great for synchronizing data between two or more systems, but there are other scenarios that don’t fit that mold. Sometimes you just want to retrieve a particular record when you need it. A salesperson may need real-time access to product inventory data, for example. Or you may have a system that can send new or changed data as an outgoing webhook. What do you do then?

As usual, the Connect capability of TIBCO Cloud Integration has you covered. In addition to standard query integrations, it has a request-reply method that handles the other scenarios. Continue reading to learn how it works.

Let’s use a simple example of retrieving real-time data from another system. Suppose we manage an online sporting goods store and want to promote a specific category of products when a customer logs in. That information exists in our CRM system, and we want to call out from the ecommerce system to get it.

Before we begin, we need to change our security settings to give an external system access to our TIBCO Cloud Integration organization. Login, naviate to the Connect capability, and choose Security from the More menu. Set an IP address range, check the box for Event Solution Access, and we’ll be ready to go.

First we will create an Integration Event Solution and give it a name.

Then we’ll create a Request-Reply map and give it a name.

Next we’ll click the map name to open the map editor and start building the map. Start with a Wait for Request block.

Open the block and select the Request tab. Then click the plus symbol to add a field. The ecommerce system knows customers by email address, so the request will have an email address field. It will look like this.

Now we’ll add a connection for the CRM system. If you have a trial subscription, you should see a connection called Granite State CRM, which you can add to the map by clicking the Add Connection link on the left. If you're using your own CRM system, adapt the instructions below accordingly.

Next we’ll build the map to get the information we want about the customer who’s shopping on our site. Add a lookup block from the Granite State CRM connection and choose the CRM_Customer entity from the drop-down list on the right.

Open the lookup block, choose the Lookup Criteria tab and click the plus symbol to add a criterion. Choose the Email field on the left.

Now click the fx symbol under Value to open the formula editor. Select Wait for Request under Source and click the plus symbol next to the Email field in the center to add the formula for the email address that comes in through the request.

Click OK to close the formula editor and navigate to the Field List tab. Check the boxes next to Category, Country, Email, First Name, Gender, and Last Name.

Click OK to return to the map editor, then add a Build Reply block to the map. Open the block and navigate to the Fields tab. Open the Results list on the left and drag each of the fields over to the right.

Close the block and add a Send Reply block to the map. If we were building this for a production system, we would want to add logic to test the lookup result and construct a different reply based on whether there was a match, but we’ll skip that step here. Click Validate to make sure the map checks out. The result should look like this.

Click OK to save the map. As it saves the map, TIBCO Cloud Integration will automatically create a unique URL that an external system can use to send a request to the map. Open the map again and copy the URL displayed on the right side. We’ll use this to make our requests.

For this example, we’ll use Postman as a proxy for the ecommerce system. If you don’t already have it, you can get a free Postman account. Open the app and choose Post from the drop-down list. Then paste the URL for the map in the box.

Choose the Body tab under the URL, select the raw radio button and choose JSON from the drop-down list. Then paste the following in the box underneath. This is the email address of one of the customers in the Granite State CRM system that’s provisioned in trial organizations.

{“Email”:”ewright1@simplemachines.org”}

Now click the blue Send button, and you should receive the following back.

From the response, we can tell that Earl Wright likes fishing, so the ecommerce system can promote our fishing products to him, while it might promote camping or water sports to someone else.

If you do not already have a TIBCO Cloud Integration subscription and you want to try request-reply maps for yourself, sign up for a free trial. When you first login, spend 5 minutes going through the orientation guide and then you’ll be ready to create your own request-reply maps.

First Published  June 23, 2017

About the Author

Paul Varley is a Product Marketing Manager at TIBCO Software.