What is CrazyEngico.com (CE)?

CrazyEngico (CE) is a one-stop solution for interview questions and answers, domain knowledge, e-learning, tutorials, articles and many more learning material.
e-learning - Intelligent e-learning tutorials and articles
Domain Knowledge Learn about various business domains/verticals such as Banking, Financial, Insurance, Healthcare and many more...
Interview Questions and Answers - Post your questions and answers. 1000+ database of ready questions and answers available to prepare for an interview.
Tutorials - 300+ video tutorials from beginner to expert level.
Articles - 300+ technical articles to understand concepts.
Forum - A technical forum to post your queries/responses.

Search Questions

Interview Questions/Answers

Ads
Question
Interview Q & A >> WCF >> Can we do transactions using MSMQ?

<< Previous Question Navigator Next >>

0        0
Can we do transactions using MSMQ? (Views: 1867)


Answers


1        1

While doing MSMQ there can be scenarios in the project, where we would like all the messages are uploaded to either MSMQ or all messages read from MSMQ. After any message is read from MSMQ, it is deleted from the queue. Therefore, some times this can be critical if there are exceptions in reading or uploading messages. As said before WCF transaction can be applied to database as well as other operations like MSMQ. So let us try to understand the same by doing a small sample.
Below is a numbered code snippet of MSMQ transactions.

1 - Send message is the exposed method in the service. We have marked this method as TransactionScopeRequired=true

2 - On the client side we have use the transaction scope to say that we are starting a transaction to MSMQ server. You can see we have used the send Message to send the messages to MSMQ.

3- We can then use Complete or Dispose method to complete or rollback the transactions.
The below MSMQ transaction code ensures that either all messages are send to the server or none are sent. Thus satisfying consistency property of transactions.


Submitted By: Manish Rathi | Created On: 9/14/2009 12:53:59 PM


Post your Answer
Your answer will be first reviewed by our administrator before it appears on the site.

Your Answer:


 
Display Name:





By clicking on Submit button you agree to the Terms of Service agreement.




Copyright © 2018 CrazyEngico.com. All rights reserved.
CrazyEngico.com is not responsible for the content and CrazyEngico.com does not evaluate or guarantee the accuracy of any CrazyEngico.com content.
Please read our terms of service agreement before using this site.

feedback