index > Visual C# General > MSMQ (Messaging Queue)

MSMQ (Messaging Queue)

Hi all,

I wan to ask of receiving message from the MSMQ. Is it possible to recieve message from any place or only from the head of the queue.

I want to pull messages from the queue not according to the first message in the head of the queue, I want to pull from a certain Id of a message.

Regards...
Wasim
You can definitely do this. Take a look at System.Messaging.MessageQueue, especially MessageQueue.ReceiveById(string id). Other useful methods are ReceiveByCorrelationId, ReceiveByLookupId, Peek, PeekById, ReceiveByCorrelationId, and PeekByLookupId. You can find code snippets in the documents linked above. Here's an example from http://msdn2.microsoft.com/library/0t877y0k(en-us,vs.80).aspx:

       // Connect to a queue on the local computer.
James Kovacs
Hi,
Ok!, but can I decide the message ID, in your example I have to know the message ID to resieve it by ID.
My target is: I want clients to recieve the message by their Id, they don't know what is the ID of the message suits to each of them.

For example, I insert 3 messages to the queue (The first message to client 1,..). I want the three clients to recieve the messages that belong to each one of them.
Maybe client 2 peek on the queue before client 1, So how can I tell hime to recieve the second message.

Regards...
Wasim
You would have to program each client to peek through the queue looking for the messages that it should be receiving and then remove it.

Another option would be to set up a separate queue for each one. If you don't want your sender(s) to know that there are multiple queues, you could have a single public (or private) queue that is the main receiver of messages. You have a component listening on the queue and distributing messages to 3 private queues, one for each client in your example above.


*** Mark the best replies as answers! || Blog: http://www.jameskovacs.com ***
James Kovacs
reply 4

You can use google to search for other answers

 

More Articles

• don't understand AppDomain.CurrentDomain.SetPrincipalPolicy
• DataBindig SQL - lesson 9 - missing part
• datagrid: parametric number of records in a page
• Static method in Remoting
• how to block all internet acess
• convert string to currency
• How do i open form2, but leave form1 as active form?
• Newbie question - How to run a command line application using C#
• Adding images to a menustrip removes all menustrip entries
• Can't use loops inside class?
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• convert help
• Serial port time out question
• Denied access to my app!
• Text to URL
• Parse a structured text file and extract
• Publish... Application Files...
• hiding console window?
• Events in C# are declared in different w
• How to convert an image to string..
• Embedded resource not working
• ExecuteScalar erro
• Method Questions
• Is it possible to change Font.Size in ta
• Bug or intentional: aspnet_Membership_Ge
• Threading, Atomic wait and exit lock

Hot Articles

• Document Classifier - Help
• Using a Console with a Windows Form...
• How to make an Outlook 2003 style naviga
• exporting millions of records
• MySQL
• Create extended stored procedure
• How C# talk with Flash Communiaction Ser
• Amazon Web Services
• xml problem
• Visual C# installation problems inside V
• Populate a treeview with a XML Schema us
• Why are some method names prefixed with
• How to insert a table into HTML page wit
• server client data send problem
• problem about treeview in Dot net 2.0

Recommend Articles

• Frame capture from avi
• general web form question
• problem about treeview in Dot net 2.0
• Web Browser
• listBox
• DataGrid multiple controls??????
• Having a container in a usercontrol rece
• Can I display any text on RowHeaders in
• Please write the linksof Free C sharp Ve
• Button Properties vs. Form Properties
• Help
• Crystal Export to PDF
• Dual MatchCollection on "A B|C D|E
• c#
• populate data from table into combobox