How to store messages on Queue

Hello Experts,

I am using UM 9.9. Could you please help me to achieve below scenario.

I am fetching the records from DB in batches and sending to queue on UM and I want to hold all the messages in queue until the last record is fetched from DB. Once all the records are fetched then only subscriber should consume all messages.

Regards,
Nikhil Pardeshi

Have you considered using transaction management? Create a JMS connection with Local transaction type and keep transaction boundaries. This will help you achieve your case…!

Hello Srikanth,

I have created the JMS connection but I am not sure how to implement transaction boundaries.

Hello Nikhil,

This is very easy. Create JMS connection with Local Transaction type. Now use the ART services “Start, Commit, Rollback” services, just like you use them with DB adapter services…

Regards,
Srikanth

Fetch all the records from DB and map it to doc list and call pub.jms:sendBatch

Hello Srikanth,

We are calling JMS over queue. JMS adapter connection is not there in our set up. I have configured JMS connection through settings->Messaging. Hence. i guess I cannot use start and commit.

Hello Mahesh,

Thanks, I will try to use and update the thread.

Hello Mahesh,

I tried implementing sendBatch but it failed and in the guide it is mentioned that we can only use pub.jms:sendBatch service with the webMethods Broker.

Any other way, you would suggest.

Nikhil,

You really do not JMS adapter connection for this. You can use JMS connection from created from messaging along with transaction management as well.

Use pub.jms.send service to send to the queue/topic with in the transaction boundaries. Make sure you create JMS connection of type Local Transaction.

Ah :shock:

Then you might have to go with pub.jms:send. Handle the transaction reading and writing through ART transactions services (Local Tx… For more details refer 9-10_Using_Integration_Server_to_Build_a_Client_for_JMS

Thank you Srikanth & Mahesh, I went through the guide and it helped me alot.
But I am facing below error while consuming the messages using pub.jms:receive

javax.jms.IllegalStateException: Consumer already closed

Any idea what could be the issue?

Regards,
Nikhil Pardeshi

Nikhil,

why are you using pub.jms:receive? Have you considered using JMS triggers, which automatically invoke a service when a message arrives on a queue/topics.

You are rite Jonathan, actually what I am doing is

1-> I am picking the data from DB in batches and pushing into 1 queue on UM along with that assigning unique Id to the batches.
2-> Once all the batches I have pushed to UM then I am pushing one more message which is having only unique Id.

And I have configured trigger for 2nd step which will extract the unique Id from the queue and pull all the messages from the 2nd queue matching the unique Ids using pub.jms:receive in that trigger service only.

Are you using the same JMS connection in both the cases?

Yes Srikanth, both queues are using same connection factory and same JMS connection.

Can you share the error stack trace?

Below is the error:

com.wm.lang.flow.FlowException: javax.jms.IllegalStateException: Consumer already closed

Hello Nikhil,

Can you pass on the full error stack trace from IS admin Console > logs > error?

Regards,
Srikanth

Hello Srikanth,

I am not getting any error in error trace, also I am getting this error only while debugging and when it is called by trigger service then it runs successfully. But not picking messages from the queue.