-1

I am sending a file of data to service bus queue and while retrieving data I am getting active message count by

queue.MessageCountDetails.ActiveMessageCount;

if this count is zero, send mail to a user that data has been uploaded. When SendReport() method hits then queueclient got message and it hits to again Client.OnMessage((receivedMessage) =>. User should get one report for each file. But in my case report has been created for multiple times. how can I send one report per file?

Prajakta Kale
  • 392
  • 3
  • 19

1 Answers1

1

Very vague but are you trying to send chunks of a file in multiple messages? If so, a better approach is to use the Claim Check pattern instead.

With this, you will process just one message from service bus, fetch the file from the external store and send an email just once.

PramodValavala
  • 6,026
  • 1
  • 11
  • 30
  • Ya! You are right but I cannot store data in database – Prajakta Kale Jan 17 '20 at 07:37
  • I appended a bit called IsLastRecord with each file and checked this bit is true or false while retrieving data from a service bus and stored that data in Collection. When I get that bit true I send mail to the user with this data – Prajakta Kale Jan 17 '20 at 07:42
  • 1
    That does work **but** do note the payload size limitations per message which would lead to many messages for larger files. Also, to ensure FIFO, you might want to consider using [Message Sessions](https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-sessions) as well with one session id per file. – PramodValavala Jan 17 '20 at 09:55