How to get only new message from IBM MQ in Logic apps

Sharma, Rahul 80 Reputation points
2023-07-30T07:27:35.0266667+00:00

Hi All,

I am trying to setup Near Real time message ingestion from IBM MQ using Logic apps.

But logic apps poll at a fixed interval and not able to fetch on only the new messages from the queue. It seems it is always picks the duplicate message.

I am using MQ trigger in standard logic app and MQ browser to read one message. I want every time when trigger the workflow it fetches only the new message which hasn't been read by previous execution of workflow.

Please let me know the correct way and what is the issue in my flow ?

TIA

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,551 questions
Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
720 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bukke SanthiSwaroop Naik 390 Reputation points
    2023-07-30T09:10:11.5633333+00:00

    the behavior of the IBM MQ trigger in Azure Logic Apps is based on polling, and it does not have built-in functionality to trigger only for new messages while ignoring old messages.

    When the MQ trigger executes, it polls the IBM MQ queue at a fixed interval and retrieves all available messages in the queue, including both new and old messages that are still present. The trigger then passes these messages to the Logic App for processing.

    As a result, the MQ trigger does not have a direct mechanism to distinguish between new and old messages based on the trigger itself. If you need to process only new messages and ignore the old ones, you would need to implement custom logic within your Logic App.

    One common approach to handle new messages while ignoring old ones is to keep track of the last processed message's timestamp or identifier in an external storage (e.g., Azure Blob Storage, Azure SQL Database). Then, during each trigger execution, you can compare the messages' timestamps or identifiers with the last processed value and filter out messages that have already been processed.

    It's essential to carefully design and implement the filtering logic to ensure that you process messages accurately while avoiding duplication or missing any important messages.

    0 comments No comments

  2. Sharma, Rahul 80 Reputation points
    2023-08-15T13:32:25.4+00:00

    We had a continuous discussion with Microsoft Support about this requirement. They mentioned that Logic app is capable to get trigged whenever a new message is available in the MQ. And they have actions to mark complete in that queue so that they will be deleted and won't picked up next time. For this they have auto complete trigger and Complete message action as well.

    They don't have any mechanism to maintain the offset due to this if you are the dedicated consumer for a queue this method work for you as in our case. But if there would be multiple consumers for the same queue then logic apps are not suitable for the read from MQ.

    Thanks,

    Rahul

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.