0

RabbitMQ supports message priority: https://www.rabbitmq.com/priority.html

MassTransit allows user to set this up when configuring endpoints and when sending/publishing a message.

Question: Would it be possible to set a message priority when using a Routing Slip in MassTransit?

My Problem: We have a screen that can schedule items or process them right away. If scheduled, items can be processed in batches. If hundreds of items are processed at the same time, saving a record on the screen can take minutes because the message would go to the end of the queue, which can lead to a bad user experience.

So, if it's not possible to set the priority, what is the alternative here?

Thanks!

igorguerra
  • 53
  • 4

1 Answers1

0

Your easiest option? Setup your activity services so that they host two endpoints, one for execute (anything, including batch) and one for execute-interactive, that you use when it is an interactive request. When you build the routing slip, use the appropriate queues for the activity execution, and you're off and running. Batch won't interfere because it's on a separate set of endpoints.

Your other option is a lot harder, and would involve creating send middleware that looks for RoutingSlip and checks some value and sets the priority.

Chris Patterson
  • 28,659
  • 3
  • 47
  • 59
  • Thanks Chris for your answer. My problem with this approach is that I want to maximize the queue concurrent message limit so we can use the most of the server. If I have 2 queues, that won't be possible. For example, let's say our servers can process 10 messages at a time. If I have one queue, I can set this limit to 10. But if I have 2 queues and I set both to 10, they will be able to go over the threshold. If I set both to 5, they won't go over the threshold, but I will have unused resource. Does that make sense? – igorguerra Aug 25 '20 at 16:16
  • It does make sense, and good luck with whatever approach you come up with based on the suggestions I gave you. – Chris Patterson Aug 25 '20 at 16:20