1

Is there any possible way where we can delete the messages based on the content of the message ? As all of these messages are stored in Bus, can we filter the messages and fetch/delete only those that have same user-id/email (a property in the message content) ?

If we use topics and add the unique identifier for user in the message headers/user-properties. Can we filter at that time ? My requirement is also to filter the scheduled messages in topic.

1 Answers1

0

Can we filter the messages and fetch/delete only those that have same user-id/email (a property in the message content)

AFAIK, the answer is no. You can't do server-side filtering on messages based on a custom property. You would need to fetch messages and do the filtering on the client side only.

UPDATE

If we use topics and add the unique identifier for user in the message headers/user-properties. Can we filter at that time ? My requirement is also to filter the scheduled messages in topic.

If you have set filtering rules so that messages are sent to different subscription based on these rules, then it becomes easier to delete those messages. In this scenario, only the messages meeting the filtering criteria will be present in a subscription thus you could simply fetch all messages in Receive/Delete mode to delete all messages. Again, server-side filtering is not supported even in this scenario.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Sorry, I've edited the post. Can you please reply back ? – Phani Thatavarthi Apr 11 '20 at 09:38
  • Can we also filter the scheduled messages ?? – Phani Thatavarthi Apr 11 '20 at 09:53
  • `Can we also filter the scheduled messages` - Nope. I just answered another question about scheduled messages: https://stackoverflow.com/questions/61153962/azure-service-bus-schedules-messages-cancellation-using-the-message-content-or-m. – Gaurav Mantri Apr 11 '20 at 09:55
  • Are there any other ways in azure app services to implement this functionality of removing the messages based on User Id (which is a user-property in the message metadata). When ever the user unsubscribes to the app, we need to delete all the messages of him from a data-structure like queue (They can be any where in the queue). We want it to be as scalable as a Queue. – Phani Thatavarthi Apr 11 '20 at 10:17
  • Unfortunately I am not aware of any solution for this scenario. – Gaurav Mantri Apr 11 '20 at 10:27