tags:

views:

3769

answers:

8

I need to work with (Microsoft Message Queuing )MSMQ. What is meant by MSMQ how it will work? In what way its is different from webservices.

+7  A: 

As its name states, it's just a queue manager.

You can Send objects (serialized) to the queue where they will stay until you Receive them. It's normally used to send messages or objects between applications in a decoupled way

It has nothing to do with webservices, they are two different things

Info on MSMQ:

http://www.microsoft.com/windowsserver2003/techinfo/overview/msmqfaq.mspx

Info on WebServices:

http://msdn.microsoft.com/en-us/library/ms972326.aspx

Juan Manuel
+5  A: 

With all due respect to @Juan's answer, both are ways of exchanging data between two disconnected processes, i.e. interprocess communication channels (IPC). Message queues are asynchronous, while webservices are synchronous. They use different protocols and back-end services to do this so they are completely different in implementation, but similar in purpose.

You would want to use message queues when there is a possibility that the other communicating process may not be available, yet you still want to have the message sent at the time of the client's choosing. Delivery will occur the when process on the other end wakes up and receives notification of the message's arrival.

tvanfosson
Thanks for the respect =)I see MSMQ as a way to send objects from app to app without needing a response passing data for the other app to do whatever it wants, and webservices as a "call to a remote function" with parameters and a result, I used each for these specific purposes
Juan Manuel
+5  A: 

Hi,

Note that you can use Windows Communication Foundation (WCF) as an abstraction layer above MSMQ. This gives you the feel of working with a service - with only one-way operations.

For more information, see: http://msdn.microsoft.com/en-us/library/ms789048.aspx

--larsw

larsw
A: 

I have had experiance with MSMQ and it was not good. It was used for a mobile handheld project over GPRS and we have loads of loss messages.

MartGriff
Given my experience on the mobile network(s), MSMQ wasn't probably your problem of loss, but the on-again-off-again network
kenny
I also have to chime in - having worked with MSMQ... I doubt it was the source of your problems.
Tim
Maybe it was not the source of the problem but MSMQ is ment to be a garanteed message even it the network is on and off due to signal. Whitch in MY experience it did not do.
MartGriff
+2  A: 

Transactional Queue Management 101

A transactional queue is a middleware system that asynchronously routes messages of one sort of another between hosts that may or may not be connected at any given time. This means that it must also be capable of persisting the message somewhere. Examples of such systems are MSMQ and IBM MQ

A Transactional Queue can also participate in a distributed transaction, and a rollback can trigger the disposal of messages. This means that a message is guaranteed to be delivered with at-most-once semantics or guaranteed delivery if not rolled back. The message won't be delivered if:

  • Host A posts the message but Host B is not connected

  • Something (possibly but not necessarily initiated from Host A) rolls back the transaction

  • B connects after the transaction is rolled back

In this case B will never be aware the message even existed unless informed through some other medium. If the transaction was rolled back, this probably doesn't matter. If B connects and collects the message before the transaction is rolled back, the rollback will also reverse the effects of the message on B.

Note that A can post the message to the queue with the guarantee of at-most-once delivery. If the transaction is committed Host A can assume that the message has been delivered by the reliable transport medium. If the transaction is rolled back, Host A can assume that any effects of the message have been reversed.

Web Services

A web service is remote procedure call or other service (e.g. RESTFul API's) published by a (typically) HTTP Server. It is a synchronous request/response protocol and has no guarantee of delivery built into the protocol. It is up to the client to validate that the service has been correctly run. Typically this will be through a reply to the request or timeout of the call.

In the latter case, web services do not guarantee at-most-once semantics. The server can complete the service and fail to deliver a response (possibly through something outside the server going wrong). The application must be able to deal with this situation.

IIRC, RESTFul services should be idempotent (the same state is achieved after any number of invocations of the same service), which is a strategy for dealing with this lack of guaranteed notification of success/failure in web service architectures. The idea is that conceptually one writes state rather than invoking a service, so one can write any number of times. This means that a lack of feedback about success can be tolerated by the application as it can re-try the posting until it gets a 'success' message from the server.

ConcernedOfTunbridgeWells
+1  A: 

As everyone has explained MSMQ is used as a queue for messages. Messages can be wrapper for actual data, object and anything that you can serialize and send across the wire. MSMQ has it's own limitations. MSMQ 1.0 and MSMQ 2.0 had a 4MB message limit. This restriction was lifted off with MSMQ 3.0. Message oriented Middleware (MOM) is a concept that heavily depends on Messaging. Enterprise Service Bus foundation is built on Messaging. All these new technologies, depend on Messaging for asynchronous data delivery with reliability.

+2  A: 

Actually there is no relation between MSMQ and WebService. Using MSMQ for interprocess communication (you can use also sockets, windows messaging, mapped memory). it is a windows service that responsible for keeping messages till someone dequeue them. you can say it is more reliable than sockets as messages are stored on a harddisk but it is slower than other IPC techniques.

You can use MSMQ in dotnet with small lines of code, Just Declare your MessageQueue object and call Receive and Send methods. The Message itself can be normal string or binary data.

Ahmed Said