Hi All, I have to poll on Multiple Queues for any inbound messages. I was
doing it fine earlier when there was only 1 Queue. I had added the
ReceiveComplete dEventHandler on the Queue and called the BeginReceive
method...
With multiple Queue's its a challenge...
I earlier implemented a logic provided by one of the forum users in which it
said to create an IAsyncResult Handle and then WaitHandle.Wait Any(array)...
but the Problem is when a new message arrives it doesn't notifies me....it
doesn't work the same as the EventHandler...
Here's the snippet I am using for Multiple Queues..its tied inside a WinSvc
protected override void OnStart(string[] args)
{
ThreadPool.Queu eUserWorkItem(n ew WaitCallback(Ex ecute));
}
void Execute(object key)
{
while(true)
{
aresMq1= mq1.BeginReceiv e();
aresMq2= mq2.BeginReceiv e();
Process();
}
}
void Process()
{
int iWaitIndex = WaitHandle.Wait Any(new
WaitHandle[]{aresMq1.AsyncW aitHandle, aresMq2.AsyncWa itHandle});
switch (iWaitIndex)
{
case 0:
Message msg1 = mq1.EndReceive( aresMq1);
Stream s1=PrepareMsg(m sg1,mq1);
writeMessage(s1 ,msg1.Label);
break;
case 1:
Message msg2 = mq2.EndReceive( aresMq2);
Stream s2=PrepareMsg(m sg2,mq2);
writeMessageEx( s2,msg2.Label);
break;
}
} 1 1469
"Vai2000" <no****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
| Hi All, I have to poll on Multiple Queues for any inbound messages. I was
| doing it fine earlier when there was only 1 Queue. I had added the
| ReceiveComplete dEventHandler on the Queue and called the BeginReceive
| method...
| With multiple Queue's its a challenge...
| I earlier implemented a logic provided by one of the forum users in which
it
| said to create an IAsyncResult Handle and then
WaitHandle.Wait Any(array)...
| but the Problem is when a new message arrives it doesn't notifies me....it
| doesn't work the same as the EventHandler...
|
| Here's the snippet I am using for Multiple Queues..its tied inside a
WinSvc
|
| protected override void OnStart(string[] args)
| {
|
| ThreadPool.Queu eUserWorkItem(n ew WaitCallback(Ex ecute));
|
| }
|
| void Execute(object key)
| {
|
| while(true)
| {
| aresMq1= mq1.BeginReceiv e();
| aresMq2= mq2.BeginReceiv e();
| Process();
| }
|
| }
|
| void Process()
| {
|
| int iWaitIndex = WaitHandle.Wait Any(new
| WaitHandle[]{aresMq1.AsyncW aitHandle, aresMq2.AsyncWa itHandle});
|
| switch (iWaitIndex)
| {
|
| case 0:
| Message msg1 = mq1.EndReceive( aresMq1);
| Stream s1=PrepareMsg(m sg1,mq1);
| writeMessage(s1 ,msg1.Label);
| break;
|
| case 1:
| Message msg2 = mq2.EndReceive( aresMq2);
| Stream s2=PrepareMsg(m sg2,mq2);
| writeMessageEx( s2,msg2.Label);
| break;
|
| }
| }
|
|
Why not simply create a thread per message queue, you don't have hundreds of
queue's I suppose?
Also, don't use the threadpool from OnStart, create a regular thread.
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sporge |
last post by:
Hi All
Is there any way to decrease the polling interval that Oracle uses to
determine if there are jobs pending in the job queue.
It appears that it takes up to 5 seconds for a job to be executed
after it has been submitted via DBMS_JOB.SUBMIT.
If possible, would it adversely affect resources by decreasing this
interval?
|
by: Vijay Varadan |
last post by:
We're using Enterprise Application Block June 2005 w/ Visual Studio 2003 .NET.
We've configured our ASP.NET web service to run under a specific domain
account using the instructions at
http://support.microsoft.com/default.aspx?scid=kb;en-us;329290
All connections to SQL Server are set to be TRUSTED. The debugger shows that
the main web service threads are (correctly) running under the specified
domain account and they are able to...
|
by: Daniel Bass |
last post by:
hey guys.
overview
---------
I'm designing a messaging system that works on the principle of late binding
to the I/O objects, depending on the .Net class libraries present in the
local folder.
I may have an output File.DLL, and ODBC.DLL, that instantiate an abstract
parent to stream data i receive... an input .DLL allows data to be streamed
|
by: Viet |
last post by:
I have a couple of questions that hopefully someone could clarify for me. I
have an app that uses the threading.timer to constantly poll a scanner to
scan in documents. I understand that Async delegates can also be used for
polling purposes. Would it be more efficient to use async delegates in this
case? Are their any examples on how to use this under vb.net forms?
Thanks,
Jonathan
|
by: Viet |
last post by:
I understand that Asynchronous delegates can be used to poll but most of the
examples show the polling being done for a specified period of time. Are
there any examples in VB.NET forms that show the polling being done
indefinitely??
| |
by: engwar |
last post by:
Is anyone aware of any freely available software written in a .Net
language for adding polling features to an existing website?
I'm looking for just a polling component and not interested in
installing something like DotNetNuke just to get polling.
Thanks
|
by: kelvin.jones |
last post by:
Hi guys, I have read several discussions on this group (and others)
that talk about polling a server using ajax transactions and if it is
possible to push to the client. The general consensus seems to be "no,
there is no way to push to client using ajax, you have to poll."
Knowing this, I assumed meebo.com and gmail talk are using the same
technique for their ajax chatting apps. However, when I use Fiddler to
sniff their http requests, I...
|
by: Mike |
last post by:
Hi everyone,
I would like to be able to send updates to my web page from the server. If I understood correctly, this is not possible to achieve in a web environment, unless some sort of polling mechanism is used. I read a few articles and some of them suggest using some Javascript, while other suggest using Web Services. Some ways to achieve some kind of polling mechanism is on this document:...
|
by: LordHog |
last post by:
Hello all,
I have a little application that needs to poll a device (CAN
communications) every 10 to 15 ms otherwise the hardware buffer might
overflow when there are message burst on the bus. I would implement an
interrupt driven model, but the external device (which is connected
via USB) does not support interrupts therefore the device needs to be
polled at a specific interval. So my question is how can I implement a
"deterministic"...
|
by: Chris Mullins [MVP - C#] |
last post by:
I'm sitting on the fence on this one, and wanted to get some other people's
input. If you're a big B2B person, I would love to hear your feedback...
I've got a SOA system. It's based on a combination of WCF Services and
ASP.Net Pages. The consumers of this service are companies all over North
America.
Essentially, we've got some long running operations that a vendor can kick
off. These opertaions can take anwhere from 5 minutes to 2...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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...
|
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...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |