Request/Reply Interactions

Request/reply interactions differ in several details. TIBCO FTL and TIBCO EMS use different objects and methods to achieve similar results.

Paradigm

The following steps distinguish code for request/reply interactions in FTL applications:
  1. In the responding program, create a subscriber to receive request messages, and a publisher to send replies.
  2. In the requesting program, create a publisher to send requests, and an inbox subscriber to receive the reply.

    Get the inbox object from within the inbox subscriber.

  3. When composing request messages, include the inbox object as a field value.
  4. Send the request message using the send method.
  5. In the responding program's callback method, extract the inbox object from the request message.

    Send the reply message directly to that inbox using the send to inbox method.

For more information, see "Request and Reply" in TIBCO FTL Development.

For example code, see the sample programs tibrequest and tibreply.

Differences

  • In place of an EMS message requestor, an FTL program uses an ordinary publisher to send requests, and an inbox subscriber to receive replies.

    That is, FTL uses separate objects, one to send the request message and another to subscribe to the reply message. In contrast, EMS consolidates them into one requestor object.

  • In EMS the request method of the message requestor object is synchronous, in that it waits for a reply.

    In FTL, replies arrive asynchronously, like any other inbound message.

  • In EMS the Reply To header of the request message indicates the reply address.

    FTL messages do not contain header fields. The inbox object serves as the reply address.

    The requesting program explicitly embeds the inbox in a field of the request message (you choose the name of that field). The responding program extracts it and sends the reply to that inbox.

  • In EMS you can link a reply message to its request using the correlation ID header.

    FTL messages do not contain header fields. You can explictly link a reply to a request with a unique ID token by including the token in a message field (you choose the name of that field). Use the token in the callback method of your requesting program to explictly correlate each reply with its request.