简体   繁体   中英

How to bulk read messages from Solace queue

Is it possible to bulk read messages from Solace queue rather than receiving them one by one on callback?

Currently MessageEventHandler receives about 20 messages per minute, this is too slow for our application.

Does anyone have a better solution to speed things up in Solace?

This is a C# application.
We used

ISession.CreateFlow(FlowProperties, IEndpoint, ISubscription,
EventHandler<MessageEventArgs>, EventHandler<FlowEventArgs>)

Passing in a MessageEventHandler which gets the message via MessageEventArgs.Message

queue = CreateQueue();  
Flow = Session.CreateFlow(flowProperties, queue, null, OnHandleMessageEvent, OnHandleFlowEvent);

..
void OnHandleMessageEvent(object sender, MessageEventArgs args)
{
var msgObj = args.Message.BinaryAttachment;
..
}
```

No, there is no API call for a user to read messages in bulk.

By default, the API already obtaining messages from the message broker in batches, with each message being individualy delivered to the application in the message receive callback. FlowProperties.WindowSize and FlowProperties.MaxUnackedMessages can change this behavior.

20 messages per minute is extremely slow.

One common reason for slowness is that the application is taking a long time to process messages in the message receive callback ("OnHandleMessageEvent"). Blocking in the message receive callback will prevent the API from delivering another message to the application.

Refer to Do Not Block in Callbacks for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM