Bharat Kumar Kotrike
Bharat Kumar Kotrike

Reputation: 11

Can we read or consume multiple messages with only one call from queue using solace python api

I have a queue with multiple topics subscribed to it. I published multiple messages to various topics and I want to read all those messages by making only one call. How to achieve this using solace python apis

I tried using persistent message receiver module in solace-pubsubplus package

Upvotes: 1

Views: 699

Answers (1)

Mrc0113
Mrc0113

Reputation: 556

Solace messaging is async delivery. You don't request a queue to send you all the message on it, but rather your app would bind to the queue once and then your app essentially gets triggered each time a message lands on the queue. This prevents you from continually having to say "are there any more messages on the queue?" every few seconds.

If you need to process multiple messages at once then your app can wait for more messages to arrive before processing them in bulk in your app. Usually your app would store the messages for X seconds or until it gets Y messages before processing them and then ACKing them. Just be sure not to block the callback/onMessage thread while you are waiting for other messages to come in.

This doesn't show the bulk message processing, but is an example of consuming using Python from a Solace queue. https://github.com/SolaceSamples/solace-samples-python/blob/main/patterns/guaranteed_subscriber.py

Upvotes: 2

Related Questions