Solved

reading the values of MSMQ properties?

Posted on 2004-03-24
7
952 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
Comment Utility
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
Comment Utility

Actually, unless
0
 

Author Comment

by:adgarcia13
Comment Utility

 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:adgarcia13
Comment Utility

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
Comment Utility

 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 500 total points
Comment Utility
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
Comment Utility

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now