-
Notifications
You must be signed in to change notification settings - Fork 1
SubQueueRouter
busterwood edited this page Jan 3, 2018
·
5 revisions
Create a SubQueueRouter
to move messages to subqueues.
Properties:
-
PeekProperties
the properties used when peeking for messages -
UnroutableSubQueue
the subqueue to move messages to on error or if therouter
function returnsnull
.
Methods:
-
StartAsync()
starts the router -
StopAsync()
stops the router -
Dispose()
also stops the router
The SubQueueRouter
constructor takes an router
argument of type Func<Message, SubQueue>
that is used to determine where to move the message to.
Note that you may like to use a QueueCache when moving messages to large numbers of SubQueues.
Moving messages to subqueue is very fast, 100 times faster than reading a message and sending it to other queues. Subqueues can be useful for:
- object-specific (client or order specific) queues, e.g. require
Message.AppSpecific
to contain the client (or order id) and use that for routing - work queues for load balancing, e.g. if there are 3 work queues move message to
Message.AppSpecific
modulus 3 - priority for transactional queues, see example
PriorityTransactionalRouter
andPriorityTransactionalReader
code examples