How to comsume all pending messages in the EMS Queue with 'Get JMS Queue Message'?

How to comsume all pending messages in the EMS Queue with 'Get JMS Queue Message'?

book

Article ID: KB0094273

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
Description:
============
The requirement can be easily achieved by using JMS Queue Receiver activity, but BW will create one job for each message received by JMS Queue Receiver activity. If the requirement is to avoid so many jobs being created, using 'Get JMS Queue Message" activity in a loop is an alternative approach.

However, in order to consume all messages from the queue using "Get JMS Queue Message" activity, it is very important to know how many messages are in the queue so that the loop containing Get JMS Queue Message activity can be executed that no. of times.

Environment:
===========

BW - All BW versions
EMS - All EMS versions

Resolution:
==========

If the "Get JMS Queue Message" activity is using "Transactional" axt mode, using it in a loop may result in messages not being acked and the activity being timed out. Refer to SOL1-BLTOH5 to resolve this. The prefetch of the queue in such situations needs to be set to "none".

For all other ack modes, use customized Java Code to get the pending message count in the desitination and then run the loop containing "Get JMS Queue Message" that many times. For more details refer to the attached comsumeAllQueueMsg.process

Attachments:
===========
comsumeAllQueueMsg.process

Key Words
==========
Consume All Pending Message, Get JMS Queue Message, JMS Transaction

Issue/Introduction

How to comsume all pending messages in the EMS Queue with 'Get JMS Queue Message'?

Attachments

How to comsume all pending messages in the EMS Queue with 'Get JMS Queue Message'? get_app