Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSMQ COM API in C#

Tags:

c#

com

msmq

What is the best way to use MSMQManagement from C#? I need the ability to peek and purge a local outgoing queue when the remote machine is disconnected.

Apparently some users can do this through the COM API, but in the COM References tab, I don't have the "Microsoft Message Queue 3.0 Object Library" that other websites/blogs/postings mention (nor anything remotely similar). I've searched the machine for Interop.MSMQ.dll and cannot find it either.

We are using VS 2008 and running on Windows 7 64-bit.

What am I missing? Are there other mechanisms to accomplish this through "normal" managed classes?

Thanks

like image 368
Dan1701 Avatar asked Nov 22 '11 22:11

Dan1701


2 Answers

Project + Add Reference, Browse tab. Navigate to c:\windows\system32 (or syswow64 on a 64-bit operating system) and select mqoa30.tlb. This creates the Interop.MSMQ.dll interop assembly you are looking for. Beware that MSMQ is an optional Windows component, you'll need to install it first if the file isn't present on your machine.

like image 86
Hans Passant Avatar answered Nov 19 '22 07:11

Hans Passant


you can use it natively from .NET by using: System.Messaging.MessageQueue

check these articles:

Accessing Message Queues

Reliable Messaging with MSMQ and .NET

like image 23
Davide Piras Avatar answered Nov 19 '22 09:11

Davide Piras