?
Solved

reading the values of MSMQ properties?

Posted on 2004-03-24
7
Medium Priority
?
968 Views
Last Modified: 2007-12-19

 Greetings,

    I've looked at the MSDN documentation and am getting somewhat confused on how to read the properities of an MSMQ message. Take lookupid for instance, If I have a message in a queue that was written as a 255 byte char message, and I then go to read the message out using MQReceiveMessageByLookupId which required the value of the LookupID to first get the message, how do I derive this ID?

 I saw an example where you start with the first message by setting lookupID to zero getting the first one and spinning through the rest, but what If I don't want to start with the first message in the queue? is there a way to read into a structure the 255 message that was written, AND the MQ properties of that message, like lookupId and other properties? would the structure def that reads the message in be defined in a generic sense something like:

 LookupID Char[18];
 OtherMQ_Properties Char[999];
 Msg_Body char[255];

 and once the message is read into a buffer mapped to the structure above I can simply get at the value of the message properties directly? or is there a much simpler wayt of doing this?

Thanks,

adgarcia13
0
Comment
Question by:adgarcia13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
7 Comments
 
LVL 5

Expert Comment

by:info_expert
ID: 10674583
Hi,
Well here is the proper link for your problem:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msmq/msmq_using_reading_msg_7ws2.asp

Any further help?

Regards.
0
 

Author Comment

by:adgarcia13
ID: 10678124

Actually, unless
0
 

Author Comment

by:adgarcia13
ID: 10678149

 Actually, unless I am missing something, the example you pointed me to assumes that the lookupid is being passed in to this function in this example so the lookupid was already acquired. My question was HOW do I get the lookupID to begin with?

adgarcia13
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:adgarcia13
ID: 10678485

This is the closest thing I found that speaks about how to get the lookupId of a specific message:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msmq/msmq_about_queues_19r9.asp

unfortunately, they never really explain How to retrieve the value of the property that identifies the message...
0
 

Author Comment

by:adgarcia13
ID: 10679209

 What might help here in trying to be a little more clear is why I am trying to derive lookupID. My thought is that I can read a message off a queue (lets call it QUE1), write it to another queue (which I will call QUE2), upon a successful write of the item in QUE2, delete the item off QUE1 using it's LookupId.

adgarcia13

0
 
LVL 5

Accepted Solution

by:
phyderous earned 2000 total points
ID: 10683136
adgarcia,

First, I hope this clear to you reading a message from MSMQ using receive delete the message,

now for you question,

I would suggest the following senrio,

you will need a listener to peek QUE1

in the peek property you should add

ULONGLONG ullLookupId;
aPropID[i] = PROPID_Q_LOOKUPID;             // Property identifier
aVariant[i].vt = VT_UI8;                    // Type indicator
aVariant[i].uhVal.QuadPart = &ullLookupId;
i++;

then upon successfull peek

the lookupid will be in ullLookupId

then send a message to QUE2
with the relavent peeked PROPS(for example: PROPID_M_BODY_SIZE,PROPID_M_BODY_TYPE,PROPID_M_BODY)

Then use MQReceiveMessageByLookupId  with the ullLookupId of the original peeked message,

Hope it helps,









0
 

Author Comment

by:adgarcia13
ID: 10779322

phyderous,

  Finally got around to doing this and it works Great, Thank You for your help! Maybe someday the MSDN website will get better at providing a greater number of clear and concise examples on using their products. Documentation is great but a picture (or robust examples in this case) says a thousand words!

 Cheers,

 adgarcia13
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question