ServiceStack and AMQP --> Create multiple exchanges

I use ServiceStack for a bunch of self hosted services. In addition to REST we need a message based approach for some ‘set and forget’ functionality, especially longer running tasks such as creating reports, sending mails etc. I need to have my own Exchanges (defined by every application) of different type, e.g. for every application one specific exchange. When using ServiceStack it seems to create three standard exchanges:

  • mx.servicestack (direct exchange)
  • mx.servicestack.dlq (direct exchange)
  • mx.servicestack.topic (topic exchange, NOT durable)

This is the same for ALL servers using ServiceStack as service library.

I there any way to create my own exchanges and configure them using ServiceStack in every application? I need different durable topic or fanout exchanges with different routing depending on the application.

Currently I use RabbitMQ and I know that I could use vhosts to achieve that. The disadvantage is, that I am kind of ‘locked into RabbitMQ’ as AMQP implementation which I do not want. I have a scenario where it is very likely that customers may want to use SQS or Azure or any other cloud based AMQP implementation.

Thanks for your feedback and suggestions.

Note the ServiceStack’s MQ support is designed around invoking your ServiceStack Services via MQ following the documented Message Workflow, it’s not designed for implementing a different/customized MQ workflows, for that you’d need to publish to your own queues/topics.

The only customization available is via the CreateQueueFilter and CreateTopicFilter delegates on RabbitMqServer which basically just lets you modify the arguments that the Queue is created with. Other than that you’d need to manually create the Queue’s yourself using the RabbitMQ.Client library directly with the same names that ServiceStack MQ expects.

ServiceStack MQ also provides MQ providers for Amazon SQS and Azure Service Bus directly, it doesn’t use an AMQP library but implements the same Server and Client interfaces where you can use the same App source code to publish to any supported MQ broker.