473,651 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I keep reading all the messages from private message queue using threads

sam
Hi,
Im using windows froms exe application to read and send messages to private
message queues.
Using threads how can I keep reading all the messages from MS private
message queuing without lossing any message thread.
Its seem to me that some messages stays in the private message queue and
want pickup by " MessageQueue.Re ceive()".
I have short code example below which im using in my application, The code
below won't read every time messages from message queues.

public class Messages
{
public Messages()
{
thd = new Thread(new ThreadStart(Msg Thread));
thd.Start();
Thread.Sleep( 10 );
}

public void MsgThread()
{
string queueRequest = .\private$\appl iaction_request
MessageQueue mq = new MessageQueue(qu eueRequest)
while (true)
{
Message msg = mq.Receive();
StreamReader sr = new StreamReader( msg.BodyStream );
string body = sr.ReadToEnd();
}
}
}

Cheers

Sam

Nov 17 '05 #1
0 1545

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

Similar topics

6
2399
by: Raymond Hettinger | last post by:
Found in a pamphlet at a pre-school: --------------------------------------- Reading improves vocabulary Reading raises cultural literacy through shared knowledge Reading develops writing skills Reading opens the mind to new ways of understanding Reading is fun Accordingly, I suggest the following works of literature:
21
13070
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the server is on one line (\r\n at end) and is formed as - each of which is seperated by a space. Arguments with spaces in them are enclosed in quotations. So, I'm able to open a connection to the server. When I send a message to
0
1249
by: Manfred Braun | last post by:
Hi All, I have a problem reading queue-messages async. My QueueReader has a Start() and a Stop() method and if my app starts, it calls Start(). The problem is, that there are possibly several hundreds of messages in the queue, which I do not want to have processed by the async messagehandler at startup. So in Start(), I create a new thread, which's method just simply enums the queue-messages . At the end of this thread, I fire an...
5
2577
by: mrkbrndck | last post by:
Please see the code below as I am trying to use multithreading for copying files to a new location in a way that improves performance of the client windows application. The problem occurs when 2 or more threads are created, the ImportOneFile method attempts to add a previously added file. If I allow 4 maximum threads and process 4 files, the last file is attempted 4 times and none of the other files are added to the destination. If I...
4
1483
by: Craig Vermeer | last post by:
Hi All, I have a program that's using the file system as a queuing mechanism, and it's consuming an inordinate amount of CPU time when the file system queue gets all that large (any more than a thousand or so messages in the queue). I know why. It's because my code to grab a single message off the queue looks something like this :
2
4613
by: SammyBar | last post by:
Hi all, I'm trying to send a message from ASP.NET to another PC by using MSMQ. I created my ASP.NET project by using Visual Studio 2005 but I initially set the project to be located on the File System. Then I could successfully send, receive and purge the public queries I use to exchange information with the another PC. But when I realized I can not reach the file system created project from a third PC then I recreated the project as...
2
1015
by: Al G | last post by:
Hi, (VS2005, SP1, VB windows form) I have a VB application that reads large files. While it is running, a record counter is being updated and shown in a text box. If I switch to another window, when I come back to the form, the text box is no longer being updated. In fact the form seems frozen until the app ends. What am I missing?
1
2906
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4 instead of Pop3. Primary reason for that :- Is we want to better meet out SLA, so we have decided to go with the 2 instances of this application, and hence decided to use IMAP4 to concurrently accessing the mailboxes via IMAP4. My issues:- Now...
3
5739
by: scriptlearner | last post by:
I am trying to put up a queue (through a logging thread) so that all worker threads can ask it to log messages. However, the problem I am facing is that, well, the logging thread itself is running forever. It does not know when it should exit. Any suggestion? None of the worker threads knows for sure when the logging thread should exit since they don't know what other worker threads are doing. I also try to set a time limit for the...
0
8277
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.