Search code examples
msmqrebus

Does Rebus support using MSMQ over HTTP/HTTPS?


I have configured a subscription as follows:

<add messages="MyNameSpace.MyMessage, MyAssembly" endpoint="FormatName:DIRECT=HTTP://mydomain/msmq/private$\myqueue.input" />

But when the bus is started and the subscription is sent, this is what I get:

Exception information: 
    Exception type: HttpException 
    Exception message: An exception occurred while attempting to send Rebus.Messages.SubscriptionMessage to FormatName:DIRECT=HTTP://mydomain/msmq/private$\myqueue.input (context: Rebus.Bus.NoTransaction)
   at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

An exception occurred while attempting to send Rebus.Messages.SubscriptionMessage to FormatName:DIRECT=HTTP://mydomain/msmq/private$\myqueue.input (context: Rebus.Bus.NoTransaction)
   at Rebus.Bus.RebusBus.InternalSend(String destination, Message messageToSend)
   at Rebus.Bus.RebusBus.InternalSend(String destination, List`1 messages)
   at RehabPathway.Infrastructure.MessagingConfig.RegisterHandlers(IContainer container)
   at RehabPathway.Infrastructure.RehabPathwayHttpApplication.Application_Start(Object sender, EventArgs e)

An error occurred while attempting to send Rebus.TransportMessageToSend to FormatName:DIRECT=HTTP://mydomain/msmq/private$\myqueue.input
   at Rebus.Transports.Msmq.MsmqMessageQueue.Send(String destinationQueueName, TransportMessageToSend message, ITransactionContext context)
   at Rebus.Bus.RebusBus.InternalSend(String destination, Message messageToSend)

Invalid queue path name.
   at System.Messaging.MessageQueue.ResolveFormatNameFromQueuePath(String queuePath, Boolean throwException)
   at System.Messaging.MessageQueue.get_FormatName()
   at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
   at Rebus.Transports.Msmq.MsmqMessageQueue.Send(String destinationQueueName, TransportMessageToSend message, ITransactionContext context)

I have confirmed that the two servers in question can send messages to each other outside of rebus across HTTP/HTTPS.


Solution

  • With the existing MSMQ transport, Rebus does not support MSMQ over HTTP/HTTPS.

    Rebus will always use ordinary private MSMQ queues, and you specify queue names like this:

     <add messages="MyNameSpace.MyMessage, MyAssembly" endpoint="myqueue.input" />
    

    to map the messages to a local myqueue.input queue, or

     <add messages="MyNameSpace.MyMessage, MyAssembly" endpoint="myqueue.input@anotherHost" />
    

    to map the messages to myqueue.input on the anotherHost machine.

    If MSMQ satisfies the same delivery guarantees when using HTTP/HTTPS, I guess there's no reason why it should not be possible to configure it somehow - it's just not supported right now.