Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

reading the values of MSMQ properties?

Posted on 2004-03-24
7
Medium Priority
?
978 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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

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. …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

578 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