Configuring the IBM IoT MessageSight resource adapter to preserve message order

Message order is important to some asynchronous messaging applications where messages must be processed in the same order in which the producer sends them. Your design must take message order into account if message order is important to your application.

About this task

One example where message order is important might be a messaging application that processes seat reservations. The messaging application might have producer components and a consumer component. A producer component sends a message to the consumer component when a customer reserves a seat. If the customer cancels the reservation, then the producer sends a second message. Typically, the consumer component must process the first message (which reserves the seat) before it processes the second message (which cancels the reservation).

Some applications use a synchronous request-response pattern where the producer waits for a response to each message before sending the next message. In this type of application, the consumer controls the order in which it receives the messages. The consumer can ensure that the order in which messages are received matches the order in which the producer or producers are sending the messages. Other applications use an asynchronous fire and forget pattern where the producer sends messages without waiting for responses. Even for this type of application, order is usually preserved. A consumer receives messages in the same order as the producer or producers send them, especially when there is a significant time between sending consecutive messages. However, your design must consider factors that can disrupt this order.

The order of messages is disrupted if your application explicitly receives a message other than the first by specifying message selectors. Parallel processing by using concurrent consumers and error or exception processing can also affect message order.

Consider the following property settings when you configure the IBM® IoT MessageSight resource adapter to ensure that messages are processed in the same order in which they are received.

Procedure

  1. Download and install the IBM IoT MessageSight resource adapter.

    The IBM IoT MessageSight resource adapter is available as part of the JMS client download. For more information about downloading the JMS client, see the IBM Watson IoT Platform - Message Gateway page in IBM Developer.

    After the download completes, you can install the IBM IoT MessageSight resource adapter on your WebSphere® Application Server. For more information about installing, see Installing IBM IoT MessageSight resource adapter on WebSphere Application Server.

  2. Configure an endpoint and setup connection and messaging policies.

    You must configure an endpoint that supports the JMS protocol for WebSphere Application Server to connect to. For more information about configuring an endpoint, see Configuring message hubs.

    • Create the following policies for inbound communications when using topics:

      • A connection policy to allow WebSphere Application Server to connect to the configured endpoint over JMS. For more information, see Authorizing client connections.
      • A topic messaging policy to allow WebSphere Application Server to subscribe to a topic over JMS. For more information, see Topic messaging policy.

    • Create the following policies for inbound communications when using queues:

      • A connection policy to allow WebSphere Application Server to connect to the configured endpoint over JMS. For more information, see Authorizing client connections.
      • A queue messaging policy to allow WebSphere Application Server to receive messages over JMS. For more information, see Queue messaging policy.

  3. Configure the IBM IoT MessageSight resource adapter properties for inbound communication. For more information, see Configuring the IBM IoT MessageSight resource adapter to preserve message order for inbound communication. If your MDB is configured to use global transactions, see Message order limitations with the IBM IoT MessageSight resource adapter.
  4. Deploy and start your MDB if applicable.