Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Need help on MSMQ and DTC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarcoB - 20 Oct 2004 06:30 GMT
I am using message queue and would like to put the message back into the
queue in case a database transaction did not succeed. The only way I see
this is:

1)using peek and then removing the message from the queue based on the
database transaction results.
2)I assume  DTC (COM+) would take care of this coordinating the queue and
the database transactions.

I have looked on the web for information on this, but was did not find much
on dot net using DTC. Is there a better alternative? If yes, is there a
sample code and documentation I could look at ?

Thanks in advance
--Marc
Tomas Restrepo \(MVP\) - 20 Oct 2004 11:56 GMT
Marc,

> I am using message queue and would like to put the message back into the
> queue in case a database transaction did not succeed. The only way I see
[quoted text clipped - 4 lines]
> 2)I assume  DTC (COM+) would take care of this coordinating the queue and
> the database transactions.

The second one would really be the only sane option.

> I have looked on the web for information on this, but was did not find much
> on dot net using DTC. Is there a better alternative? If yes, is there a
> sample code and documentation I could look at ?

Look at the docs on using ServicedComponents. Basically, what you'll want is
to write a Serviced Component that has transactions enabled
(TransactionOption.Required or similar), and that reads the message from the
queue, and writes to the database, and let COM+ abort the distributed
transaction on error.

This article contains an example of doing something similar to what you
want:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bdad
otnetasync2.asp


Signature

Tomas Restrepo
tomasr@mvps.org

Alvin Bruney [MVP] - 20 Oct 2004 14:28 GMT
Don't cross post. There's no need to send this to all these newsgroups!

You should read the message rather than peek it. The assumption is that if
all goes well, the message is gone. Use a catch block for failed attempts in
the database or where ever. On failure, put the message back in the queue in
the catch block for reprocessing.

Signature

Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok

>
> I am using message queue and would like to put the message back into the
[quoted text clipped - 12 lines]
> Thanks in advance
> --Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.