loekd/ServiceFabric.ServiceBus

Number of messages read by listener

Closed this issue · 3 comments

Thanks for providing the library for service fabric. Much appreciated. I have few questions regarding the listener implementation -

Let's suppose I have a service bus queue with 100 messages and 1 stateful service is listening to the queue using your implementation, then

  1. How many messages will be read by my stateful service, will it read all the messages from the queue (one after another) and mark it complete before processing gets completed by the "handler" function? Is there a way to limit the number of message read?

  2. In your demo project, "Handler" function implements "AutoCompleteServiceBusMessageReceiver", does this mean the message will be marked as complete only when the "handler" function returns true or is it automatically marked complete as soon as its read by listener logic?

  3. Is there another class (similar to AutoCompleteServiceBusMessageReceiver ) which can only peek messages and doesnt autocomplete them ?

  4. Is there a way to filter the messages by using Sessions feature in Service bus ?

  5. Can I have more than one listener like Wcflistner along with your listener?

Thanks
Sai

loekd commented
  1. There's support for single message processing using ServiceBusCommunicationListener and batch processing using ServiceBusQueueBatchCommunicationListener .
    Message Completion for single messages is manual by default. Prefetch count can be configured using ServiceBusMessagePrefetchCount.
  2. If AutoComplete is true, the message is completed if there's no exception while processing.
  3. Keep IServiceBusMessageReceiver.AutoComplete false to receive messages and not complete them, or complete manually.
  4. Session support is available. Filter messages by using 'Subscriptionsinstead ofQueues`.
  5. Yes, provided you give a unique name to every listener.

First thanks for giving a library for service fabric.
I ran your code with instance count set to -1 but unfortunately the same message gets repeated. I tried setting Autocomplete to true, also manually tried to set receive mode to Peek Lock. But still the message gets repeated. Any insights would be appreciated. Thanks again

loekd commented

Can you configure and run the demo project, to see if that works correctly? Next you can compare your code with the demo code.