EOIO Processing with JMS Exclusive Queues

There are certain integration scenarios where processing messages in sequence is crucial for business processes. That is, the order in which messages are processed is important. This technique is known as Exactly Once In Order (EOIO) or In-Order processing.

Can we achieve EOIO processing in SAP Integration Suite (BTP IS/CI/CPI)? As you may know, in SAP Process Orchestration (SAP PI/PO), this was possible.

For example, imagine a scenario where you are connected to a database system and need to insert or update data records, where the order of SQL statements is important. This could be for order processing, delivery tracking, or financial document posting. In such cases, it is critical to maintain the correct sequence of message processing.

Messages should be processed in the order they are received. If a particular message fails, any subsequent messages should not be processed until the failed message is successfully retried and completed.

In this article, we will explore:

  1. How Exclusive JMS queues in SAP Integration Suite enable EOIO processing
  2. A step-by-step implementation and configuration guide using the JMS Exclusive queue option

Understanding EOIO and Other Message Processing Methods

Let’s understand the difference between EOIO and other message-processing techniques when it comes to SAP or system integration.

Best Effort (BE) – Messages are processed as they arrive, with no guarantee of order.

Exactly Once (EO) – Ensures a message is processed only once, avoiding duplication but without enforcing order.

Exactly Once In Order (EOIO) – Ensures that messages are processed in the exact sequence they were received and that no subsequent message is processed until the previous one is completed.

Failed Messages Block Subsequent Processing

Can an Exclusive JMS Queues in SAP Integration Suite Achive EOIO?

As of now, SAP Integration Suite provides two types of JMS queue options: Exclusive and Non-Exclusive.

JMS Access Types Non-Exclusive and Exclusive Queues

JMS queues of type Exclusive cannot be processed by multiple worker nodes or multiple consumers. Messages in an Exclusive JMS queue can only be processed by a single node, ensuring in-order processing. The JMS sender adapter picks up and processes messages sequentially, from the oldest to the newest, in the exact order they were received.

If a message in the JMS queue fails to process, the messages that come after it will not be processed until the failed message is successfully retried and completed. This makes the Exclusive JMS queue a viable option for scenarios where message order is crucial or where EOIO (Exactly Once In Order) processing is required.

While Non-Exclusive JMS queues allow messages to be processed by multiple nodes or consumers, they do not guarantee the order of processing.

Sample iFlow with Exclusive and Non-Exclusive Queues

To demonstrate the difference in behavior between Non-Exclusive and Exclusive queues, I created the following integration flows:

Message Produsor iFlow

  • Flow 1 produces messages and places them in two queues: one in an Exclusive Queue (ProductQueueExclusive) and the other in a Non-Exclusive Queue (ProductQueue_NonExclusive).
JMS Message Producer iFlow

Message Consumer iFlow(s)

  • There are two JMS listeners (consumer iFlows): one retrieves messages from the Exclusive Queue, and the other retrieves messages from the Non-Exclusive Queue.

The processing logic for both consumer iFlows is the same; both attempt to update a table in the SAP HANA Cloud Database.

iFlow that Consumes Messages from JMS Exclusive Queue

iFlow to Process from Exclusive JMS Queue
JMS Sender Adapter Configuration -Exclusive Access Type

iFlow that Consumes Messages from JMS Non-Exclusive Queue

iFlow to Process from Non-Exclusive JMS Queue
JMS Sender Adapter Configuration – Non-Exclusive Access Type

Testing The Behavor of Exclusive vs Non-Exclusive JMS Queue Consumption

I have pushed the same 3 messages to both JMS queues. They are now waiting to be picked up and processed by the respective iFlows.

JMS Message Queue Monitor

For demonstration purposes, I have made the SAP HANA Cloud Database unavailable so that JMS messages from both queues cannot be processed successfully by the receiver.

SAP HANA DB Not Availabe

JMS Non-Exclusive Queue Consumer

In the Non-Exclusive queue, you will notice that the consumer picks up all the messages from the queue—in this example, all three messages—and attempts to process them.

JMS Non-Exclusive Queue Messages Being Processed

JMS Exclusive Queue Consumer

However, in the Exclusive queue, only the first message that entered the queue is picked up for processing. The remaining messages are not picked up because the first message has not been fully processed successfully. This behavior ensures EOIO (Exactly Once In Order) or FIFO (First In, First Out) sequencing.

JMS Exclusive Queue Messages Being Processed

Other Considerations when Working with JMS Exclusive Queues

Header Parameter SAPJMSRetries is Not Available for Exclusive Queues

We usually use the JMS header parameter SAPJMSRetries to determine how many times a message has been attempted for processing by the JMS sender adapter. Based on this, we can build logic to set a maximum number of retries and send the message to a Dead Letter Queue (DLQ) if SAPJMSRetries exceeds the defined limit. This is typically done to prevent endless message processing.

However, the SAPJMSRetries header parameter is only available for Non-Exclusive queue consumers. If you are using an Exclusive queue, you cannot use the SAPJMSRetries header parameter.

What If the Adapter and Message Producer Do Not Support EOIO?

In my view, EOIO in SAP Integration Suite cannot be guaranteed if the message producer does not ensure EOIO processing. For example, if messages are produced by SAP S4 HANA and being sent by the SOAP adapter, XI adapter, or HTTP adapter, and the sender-side adapter or SAP system does not guarantee that messages are received in the correct order to SAP Integration Suite, then we cannot ensure EOIO behavior for the end-to-end (E2E) scenario just by using a JMS queue.

Summary of EOIO Processing with JMS Queues in SAP Integration Suite

Unlike in SAP PI/PO, SAP Integration Suite did not initially have a standard mechanism for processing messages in EOIO (Exactly Once In Order) mode. However, with the introduction of the “Access Type” feature in the JMS adapter, we now have the option to process messages in a FIFO sequence. By using an “Exclusive” JMS queue, messages can be picked and processed sequentially, from the first arrived to the last.

However, ensure that the message producer can guarantee EOIO; otherwise, maintaining the correct sequence may not be possible when you take the E2E integration.

Hope you enjoyed the article! If you’d like to learn SAP Integration with me, check out my Online Course on SAP Integration Suite.

Encode Message Payload to Base64 on CPI!

How to use Base64 message encoder in SAP Integration Suite.

Subscribe for more

My First Interface on CPI!

Learn how to develop your first iFlow on SAP Integration Suite within 7 minutes!

Subscribe for more

Leave a Reply

Your email address will not be published. Required fields are marked *