0

I'd like to communicate from my web app to an endpoint on a different tier via MSMQ. I've found examples of how to do this by binding with WCF, but not how to with WebAPI.

Why do I have to use WCF?

Are they any other alternatives?

Ev.
  • 7,109
  • 14
  • 53
  • 87
  • You don't. You use the MSMQ client library in the System.Messaging namespace. Why would you use WebAPI or WCF? –  Dec 04 '14 at 04:50
  • @Amy WCF allows a level of encapsulation around the specific protocol, allowing OP to seamlessly switch to other one way communication protocols without changing code, e.g. IBM Websphere MQ (MQ Series). – StuartLC Dec 04 '14 at 04:55
  • What makes you think you do need to? – Erik Funkenbusch Dec 04 '14 at 05:35

1 Answers1

3

Other than WCF's netmsmqBinding, you could also obviously use the more native System.Messaging.MessageQueue .Net classes to read and write directly from queues. However, it sounds like you are trying to pull messages from a client such as a browser?

Although you can send messages to MSMQ via Http, you can't receive messages over Http directly.

So TL;DR I believe you will need to write your own capability to receive messages via HTTP / REST etc, e.g. via a WebApi controller action which reads exactly one message and returns same. In doing so you will likely lose any transactional boundary across queue messages.

Community
  • 1
  • 1
StuartLC
  • 104,537
  • 17
  • 209
  • 285