Request/Reply

In a request/reply scenario, one application sends a message to another and expects a reply message such as a response code, query result, or receipt confirmation. For more details, see the FTL Development guide, Request/Reply and the FTL Concepts Guide, Request/Reply with Inbox Token.

The tibftlrequest and tibftlreply applications are used in this example.

Perform these steps:

  1. Open two terminals. Make sure you have run the setup command and started the FTL server. See the Command Reference.

  2. In one of the terminals, start the tibftlreply application which is in the samples\bin directory. The start command and output follows.

    • Linux and macOS:

      $./tibftlreply localhost:8080
    • Windows:

      >tibftlreply localhost:8080
  3. Check the reply.

#

# tibftlreply

# (FTL) TIBCO FTL Version <n.n> V<n>

#

# Client name tibftlreply_44316

#

Waiting for message(s)

  1. In the other terminal, start tibftlrequest which is in the samples\bin directory to send a request to tibftlreply.

    • Linux and macOS:

      $./tibftlrequest localhost:8080
    • Windows:

      >tibftlrequest localhost:8080

Check Your Result

The reply returns quickly and you’ll see output like the following.

Requester

The Sending request message: line shows the message tibftlrequest sent to tibftlreply. Two string fields are defined, including a field type with the value request. After the replyer responds the Reply message received line displays the response.

#

# tibftlrequest

# (FTL) TIBCO FTL Version <n.n> V<n>

#

# Client name tibftlrequest_44319

#

Sending request message: {string:type="request", string:client_name="tibftlrequest_44319"}

Reply message received: {string:type="reply", string:client_name="tibftlreply_44316"}

Replyer

The tibftlreply application looked for a field called type with a value of request. When the request is received, the application returns a message with the type field value reply and the client_name field with the client identifier of the tibftlreply application.

Received request: {string:type="request", string:client_name="tibftlrequest_110685"}

Reply sent: {string:type="reply", string:client_name="tibftlreply_110663"}

A request can contain any number of fields with any type of content needed by an application.