MSMQ newbie - questions for transactions and queues

Answered MSMQ newbie - questions for transactions and queues

  • Thursday, April 19, 2012 10:38 PM
     
     

    I will be developing an application which will be multithreaded to process messaging both incoming and outgoing.

    I believe I will be using WCF Services for this. It will either be a self hosted service or something else.

    Having only heard of MSMQ but never actually experienced it or know much about it, im very impressed with the documentation and about what MSMQ actually is, how it works etc... it really sounds exactly what I am looking for.

    I need to know how it is possible to know when message has been recieved and is in the MSMQ and how the application (WCF service) can get notified of that message?

    What about when a message fails to be sent either due to network outage, OR it has failed to be acknowledged by the recepient? How can my service get notified of this and how can I attempt to retry sending the same message? In regards to retrying, I know MSMQ/WCF can do this for me but is there anything else I need to do?

    Basically im trying to do 2 things here:

    1) Write a POC (Proof of Concept)

    2) know some code to do exactly what I want.

    The application will be multithreaded and does need to know if a message has been sent and received successfully, if not, then I need to get some form of a NACK and be able to then do what I need to do for my own business logic (i.e NACK received therefore I need to send an email or log to DB or dance like a monkey)

    I need guarenteed assurance that a message is delivered or not. I know I would need to use transactional scope here, which is just fine. I also need to make sure messages aren't duplicated.

    Anything I need to take into consideration for Multithreaded purposes?

    Finally, what if the application (receiver for example) is shutdown for whatever reason. I still want to be able to process those messages. I understand that MSMQ will have those messages in the queue, waiting to be processed - how would the application handle this, to be able to read those unprocessed messages?

    if it helps, I'll be using C# for development (VB.NET examples are also welcome!)

    Thanks!


    C# MVP (2007-2010) MS Vendor - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator

All Replies

  • Monday, April 23, 2012 8:29 AM
     
     Answered

    If you are using your service as IIS hosted(WAS) using any of the MSMQ bindings, then IIS will wake your service as soon as a message is received in monitored queue. So from your requirements WAS looks to be a good option for you.

    For retrying the failed messages, you can setup the journaling and deadletter queues.

    Thanks

    Sudhir

    • Marked As Answer by ahmedilyas Monday, April 23, 2012 8:38 AM
    •  
  • Monday, April 23, 2012 8:38 AM
     
     

    Thank you. sound great. as always MS provides great solutions and has literally NEVER let me down in the 15 years ive been using products and services.


    C# MVP (2007-2010) MS Vendor - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator