Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MSMQ Guide

126 views
Skip to first unread message

MSMQ Admin

unread,
Jul 9, 2008, 9:57:00 AM7/9/08
to
Can some one suggest me a guide to learn MSMQ ! I got the MSMQ in my system
with WindowsXP and I also created a private queue and sent msgs. I dono what
exact process is happening and I would like to see if there is any console
for this MSMQ like explorer or some thing else? I appreciate your responce.
Thanks

Frank Boyne

unread,
Jul 13, 2008, 11:04:46 PM7/13/08
to
"MSMQ Admin" <MSMQ...@discussions.microsoft.com> wrote in message
news:4C3C78D7-EA1F-4A2D...@microsoft.com...

> Can some one suggest me a guide to learn MSMQ !

There are some books available but I haven't read any of them so I have
no idea how much detail they provide. Still that would be one place to
start. The MSDN Magazine has published some MSMQ articles over the
years, you could search there:
http://msdn.microsoft.com/en-us/magazine/default.aspx

There are some useful blogs as well. John Breakwell has a good one and
his blog also offers links to various other ones
http://blogs.msdn.com/johnbreakwell/

The SDK also has some how to and background articles, start here and
drill down
http://msdn.microsoft.com/en-us/library/ms711472(VS.85).aspx

> I would like to see if there is any console
> for this MSMQ like explorer or some thing else? I

Go to the Computer Management snap-in (e.g., Administrative Tools |
Computer management). Expand the "Services and Applications" node.
Expand Message Queuing, then expand Private Queues and finally expand
one of your private queues..

Right click on "Message Queuing" for various commands pertaining to MSMQ
as a whole, and to get access to MSMQ properties. Right click on
Private Queues to get a command to let you manually create a new private
queue. Right click on a private queue to view the properties of the
queue itself. Right click on "Queue messages" to get a command to purge
the queue and a command to refresh the right hand panel.

Click on the "Queue messages" node to select it and the right hand panel
will display the contents of the queue 9actually it will only show you
the first thousand messages or so). Double click on an individual
message to view its properties.


MSMQ Admin

unread,
Jul 14, 2008, 10:56:03 AM7/14/08
to
Thank You Very Much Frank.
Is there any chance that I can get the MSMQ client onto the SQL Server?

Frank Boyne

unread,
Jul 14, 2008, 6:14:20 PM7/14/08
to
"MSMQ Admin" <MSMQ...@discussions.microsoft.com> wrote in message
news:9A506F8D-0AE6-4045...@microsoft.com...

> Is there any chance that I can get the
> MSMQ client onto the SQL Server?

I'm sorry, I don't understand the question. I'll try answering a few
and hope I hit on the right one.

Can I install MSMQ and SQL Server on the same system? Yes
Can a client program access MSMQ and SQL server at the same time? Yes
Can an SQL server stored procedure make MSMQ calls? Yes (I think)

If I haven't answered the question you wanted to ask, could you ask
again please?


MSMQ Admin

unread,
Jul 15, 2008, 9:00:41 AM7/15/08
to
Sorry for not beeing clear. Here's my question : SQL Server and MSMQ are
installed on same machine. How can I Configure MSMQ with SQL.

Frank Boyne

unread,
Jul 16, 2008, 3:20:24 PM7/16/08
to
"MSMQ Admin" <MSMQ...@discussions.microsoft.com> wrote in message
news:30E32B2B-1759-4F66...@microsoft.com...

> SQL Server and MSMQ are
> installed on same machine. How can I Configure MSMQ with SQL.

There isn't any configuration required for SQL and MSMQ to work
together.

Here's a KB article that shows one technique for sending a message to an
MSMQ queue from an SQL stored procedure
http://support.microsoft.com/kb/555070

The MqTrans sample application in the Platform SDK shows how to
manipulate a queue and an SQL database as part of a coordinated
transaction using C++. For example you could remove a message from a
queue and update an SQL database based on the contents of that message
or else you could send a message and update an SQL database. In either
case, if the transaction commits both the MSMQ action and the SQL action
are commited (or neither is)
http://msdn.microsoft.com/en-us/library/ms701547(VS.85).aspx


Peleg

unread,
Dec 21, 2008, 4:43:01 PM12/21/08
to
i want using vbscript, to peek the first message and get it size :
1)how can i using vbscript get a message size?
2)how can i get out of the Q a message if i want and delete it.

thanks in advance
peleg

Frank Boyne

unread,
Dec 22, 2008, 7:46:20 PM12/22/08
to
"Peleg" <Pe...@discussions.microsoft.com> wrote in message
news:3B388797-AFFF-43D5...@microsoft.com...

> 1)how can i using vbscript get a message size?

You can't really get the size of the whole message, you can get the size
of the message body which makes up most of the message (usually). Use
Peek to retrieve the first message from the queue without removing it
(or use PeekCurrent and PeekNext to work your way down the queue to the
message you want). Then, access the BodyLength property.

> 2)how can i get out of the Q a message if i want and delete it.

Call Receive to remove the message. The trick is to make sure you
remove the message you want to remove. One way to do that is to use
ReceiveByLooupId.

The following script demonstrates the basics. I've left out error
handling, timeouts, etc. If the queue is empty this script will hang
until a message appears in the queue.

Option Explicit

const MQ_RECEIVE_ACCESS = 1
const MQ_SEND_ACCESS = 2

const MQ_DENY_NONE = 0

Dim qi
set qi = WScript.CreateObject("MSMQ.MSMQQueueInfo")
'qi.FormatName = "DIRECT=OS:BadWolf\private$\testqueue"
'qi.FormatName = "DIRECT=TCP:192.168.1.2\private$\testqueue"
'qi.FormatName =
"DIRECT=HTTP://BadWolf.example.com/msmq/private$/testqueue"
qi.PathName = ".\private$\testQueue"

Dim q
set q = qi.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)

Dim msg
set msg = q.Peek

' show the size of the message body
WScript.Echo "Body Size: " & CStr (msg.BodyLength) & " bytes"

' remove msg from the queue
q.ReceiveByLookupId (msg.LookupId)


pelegk1

unread,
Dec 23, 2008, 11:05:00 AM12/23/08
to
first thanks alot!
second - where in the registry i can set the "private queues view" ->what i
mean when i open the private queues and right click and select ->view i can
set the columns that i see (i assume that it saved somewhere i nthe registry
and i want it to open dirffrent that the default setting today).

thanks i nadvance
Peleg

Frank Boyne

unread,
Dec 23, 2008, 12:26:43 PM12/23/08
to
"pelegk1" <pel...@discussions.microsoft.com> wrote in message
news:20FA498F-523E-4DA5...@microsoft.com...

> second - where in the registry i can set the "private queues
> view" ->what i
> mean when i open the private queues and right click and select ->view
> i can
> set the columns that i see (i assume that it saved somewhere i nthe
> registry
> and i want it to open dirffrent that the default setting today).

I don't think that information is saved in the registry, it's kept in an
MMC stored console (.msc) file.

You can temporarily change the view quite easily. With the current view
displayed, right click on the selected node in the left-hand panel then
select View | Add/Remove columns. That will let you add new columns to
the view, change the order of the columns and change the width of
columns. The problem is, you lose all those alterations when you shut
down the snap-in.

To create your own mmc console, start by running MMC with the /a command
line switch to run in 'author' mode. Then, use File | Add/Remove
snap-in to add the "Computer Management" snap-in to your Console. Drill
down to the private queue view you want to modify and use Add/Remove
Columns to change it the way you want. Finally, use File | Save As to
save your creation as a .msc file.

Now, when you want to see your view, open the .msc file you created
instead of the usual admin snap-in (you can use the command MMC
yourFile.msc or just double click on the .msc file in Explorer). If you
want to change your view again, run MMC against your .msc file with the
/a switch again (MMC yourFile.msc /a).

I don't recommend this but, if you want to modify the 'real' Computer
Management views edit the file %SystemRoot%\system32\compmgmt.msc


pelegk1

unread,
Dec 27, 2008, 8:51:00 AM12/27/08
to
1)can your refer me to a code smple's like the one you gave me above?
2)can you refer me to a documnetation aon each proptety of the object you
gave me in the scriptt and moe...
thanks in advance
peleg

Frank Boyne

unread,
Dec 29, 2008, 4:52:24 PM12/29/08
to
"pelegk1" <pel...@discussions.microsoft.com> wrote in message
news:41C785EC-2618-4CC1...@microsoft.com...

> 1)can your refer me to a code smple's like the one you gave me above?

Sorry, there aren't a lot of code samples available for VBScript. If
you are familiar with VB and with scripting you can often adapt a VB
sample to VBScript.

> 2)can you refer me to a documnetation aon each proptety of the object
> you
> gave me in the scriptt and moe...

What you want is the Message Queuing COM Component documentation
http://msdn.microsoft.com/en-us/library/ms704064(VS.85).aspx

From there you can drill into a component like MSMQQueue and examine the
methods and properties of that object. The documentation for a
particular property or method sometimes has sample code for C++ and
Visual Basic.

To determine the values of constants like MQ_DENY_NONE you need to look
at the type library using a tool like OleView or Visual basic's Object
Browser or else look in the mq.h header file in the SDK.


0 new messages