473,408 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Message Queue in C# : Priority

Hi,

I have a question on Microsoft Message Queue. How do I give higher priority
to messages and get it process before others. I will like to use the
mechanism supplied by the queue service rather than relying on reading all
the messages and ordering them. Below I have a simple send and receive.

System.Messaging.Message msg = new System.Messaging.Message();
msg.Body=myPayment;
MessageQueue msgQ =new MessageQueue(".\\Private$\\billpay");
msgQ.Send(msg);
msgQ.Formatter = new XmlMessageFormatter(arrTypes);
myPayment=((Payment)msgQ.Receive().Body);

Your assistants will be greatly
appreciated.

ThanksTiger
Nov 17 '05 #1
1 2184
tiger,

You can set the Priority property of the message to a priority, but it's
not very granular.

The only way to really handle this is to read the messages from the
queue as they come in, and then process them in the order that you want.
MSMQ doesn't really guarantee order.

What you might want to do is store the ids of the messages as you send
them. On the server side, you would read the messages and store them, along
with their ids. Then, on the client, when you know you have sent the
messages, you send another message indicating which messages to process (and
possibly order).

Of course, this means that you will have to wait until all of those
messages come in to process.

This makes me think that your approach could be improved upon. Instead
of sending all of these messages which require specific ordering, why not
just send ONE message which has the tasks that need to be performed, and
have the server process that?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"tiger" <aa*****@omega.uta.edu> wrote in message
news:uQ*************@tk2msftngp13.phx.gbl...
Hi,

I have a question on Microsoft Message Queue. How do I give higher
priority
to messages and get it process before others. I will like to use the
mechanism supplied by the queue service rather than relying on reading all
the messages and ordering them. Below I have a simple send and receive.

System.Messaging.Message msg = new System.Messaging.Message();
msg.Body=myPayment;
MessageQueue msgQ =new MessageQueue(".\\Private$\\billpay");
msgQ.Send(msg);
msgQ.Formatter = new XmlMessageFormatter(arrTypes);
myPayment=((Payment)msgQ.Receive().Body);

Your assistants will be greatly
appreciated.

ThanksTiger

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: newsock | last post by:
What differences between queue, deque and priority_queue? And under what situations choose one of them to use? Thanks for your help!
1
by: tiger | last post by:
Hi, I have a question on Microsoft Message Queue. How do I give higher priority to messages and get it process before others. I will like to use the mechanism supplied by the queue service...
3
by: PicO | last post by:
i need some explanation about the difference between priority queue & set & heap ... as they all sort the data in ( n log n ) ... but the only i see that priority queue only can pop the top (...
14
by: AlarV | last post by:
Hello everyone, here is my problem. I have to make a dynamic priority queue,which is a heap, and my book isn't helpful at all, so I have no clues on how to create it.. I read something like a static...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.