473,325 Members | 2,771 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,325 software developers and data experts.

MSMQ Async Receive

hi all, I have a winsvc which reads of messages out an MSMQ. Can someone
help with this problem.
If my server goes down and comes back up my WinSvc doesn't picks up messages
accumulated in the MSMQ , although my WinSvc is set to automatic restart
setting.
I have to manually go and restart the service then only it retrieves all the
messages from the MSMQ.
This is the code.....

/////////////////////////////////////////

protected override void OnStart(string[] args) // WinSvc
{
try
{
this._mqInbound.ReceiveCompleted += new
System.Messaging.ReceiveCompletedEventHandler(this .mqInbound_ReceiveComplete
d);
this._mqInbound.BeginReceive();
}
catch(Exception e)
{
// log exception
}

}

void mqInbound_ReceiveCompleted(object sender,ReceiveCompletedEventArgs
asyncResult)
{
// do something
messageQueue.BeginReceive();
}
/////////////////////////////////////////
TIA
Nov 16 '05 #1
3 5781
Is your service marked as dependant on the MSMQ service itself?
--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Vai2000" <no****@microsoft.com> wrote in message
news:#A**************@TK2MSFTNGP11.phx.gbl...
hi all, I have a winsvc which reads of messages out an MSMQ. Can someone
help with this problem.
If my server goes down and comes back up my WinSvc doesn't picks up messages accumulated in the MSMQ , although my WinSvc is set to automatic restart
setting.
I have to manually go and restart the service then only it retrieves all the messages from the MSMQ.
This is the code.....

/////////////////////////////////////////

protected override void OnStart(string[] args) // WinSvc
{
try
{
this._mqInbound.ReceiveCompleted += new
System.Messaging.ReceiveCompletedEventHandler(this .mqInbound_ReceiveComplete d);
this._mqInbound.BeginReceive();
}
catch(Exception e)
{
// log exception
}

}

void mqInbound_ReceiveCompleted(object sender,ReceiveCompletedEventArgs
asyncResult)
{
// do something
messageQueue.BeginReceive();
}
/////////////////////////////////////////
TIA

Nov 16 '05 #2
Nops

"Klaus H. Probst" <us*******@vbbox.com> wrote in message
news:e0**************@TK2MSFTNGP11.phx.gbl...
Is your service marked as dependant on the MSMQ service itself?
--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Vai2000" <no****@microsoft.com> wrote in message
news:#A**************@TK2MSFTNGP11.phx.gbl...
hi all, I have a winsvc which reads of messages out an MSMQ. Can someone
help with this problem.
If my server goes down and comes back up my WinSvc doesn't picks up

messages
accumulated in the MSMQ , although my WinSvc is set to automatic restart
setting.
I have to manually go and restart the service then only it retrieves all

the
messages from the MSMQ.
This is the code.....

/////////////////////////////////////////

protected override void OnStart(string[] args) // WinSvc
{
try
{
this._mqInbound.ReceiveCompleted += new

System.Messaging.ReceiveCompletedEventHandler(this .mqInbound_ReceiveComplete
d);
this._mqInbound.BeginReceive();
}
catch(Exception e)
{
// log exception
}

}

void mqInbound_ReceiveCompleted(object sender,ReceiveCompletedEventArgs
asyncResult)
{
// do something
messageQueue.BeginReceive();
}
/////////////////////////////////////////
TIA


Nov 16 '05 #3
Well... it should =)

Then the SCM will start your service after MSMQ and all things being equal
your code should work as you expect it to.
--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Vai2000" <no****@microsoft.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Nops

"Klaus H. Probst" <us*******@vbbox.com> wrote in message
news:e0**************@TK2MSFTNGP11.phx.gbl...
Is your service marked as dependant on the MSMQ service itself?
--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Vai2000" <no****@microsoft.com> wrote in message
news:#A**************@TK2MSFTNGP11.phx.gbl...
hi all, I have a winsvc which reads of messages out an MSMQ. Can someone help with this problem.
If my server goes down and comes back up my WinSvc doesn't picks up

messages
accumulated in the MSMQ , although my WinSvc is set to automatic restart setting.
I have to manually go and restart the service then only it retrieves all
the
messages from the MSMQ.
This is the code.....

/////////////////////////////////////////

protected override void OnStart(string[] args) // WinSvc
{
try
{
this._mqInbound.ReceiveCompleted += new

System.Messaging.ReceiveCompletedEventHandler(this .mqInbound_ReceiveComplete d);
this._mqInbound.BeginReceive();
}
catch(Exception e)
{
// log exception
}

}

void mqInbound_ReceiveCompleted(object sender,ReceiveCompletedEventArgs asyncResult)
{
// do something
messageQueue.BeginReceive();
}
/////////////////////////////////////////
TIA



Nov 16 '05 #4

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

Similar topics

0
by: Andrew Gordon | last post by:
I'm investigating getting Microsoft Navision to do stuff from a Python script. The recommended way seems to be to use message queues (MSMQ). I can get Navision to send a message to itself fine. I...
1
by: **** KiteOregon **** | last post by:
I need to send & receive XML Document Objects via the Message Queue. We have several applications that insert XML Document Object into the message queue. This works with no problem. I am trying...
1
by: Kevin C | last post by:
When designing an asynchronous service-based system, generally speaking whose responsibility is it to determine when a duplicate request is sent - the system hosting the service or the feeding...
8
by: MuZZy | last post by:
Hi, Could someone pls help me here: If i use async sockets in the separate thread like this: void ThreadFunction() { ..... 1. MySocket.BeginAccept(AsyncCallBack(OnConnectRequest),...
1
by: Richard Atkinson | last post by:
I would appreciate help on the Microsoft Message Queue. Basically I would like to Serialize an entire class into a message queue and then reinstantiate the class in another application from the...
8
by: Dinsdale | last post by:
I am trying to write a Tcp "Server" that opens a class that wraps a tcp socket when a new connection is made (Listener.AcceptSocket()). Everything is going swimmingly except when I try to close the...
15
by: dennis.richardson | last post by:
Greetings all. Here's a problem that's been driving me nuts for the last 48 hours. I'm hoping that someone has come across this before. I have a C# Application that reads a UDP broadcast...
1
by: Florence Tissot | last post by:
We are seeing some kind of resource leak in our performance lab running an ASP.NET (2.0) application that sends and receives messages from 2 public MSMQ queues. Here's a brief summary of what are...
0
by: ASPnewb1 | last post by:
Hello, I have a question about MSMQ as I'm new to using this system in the .NET framework. Here is my following application that I run 2 instances of to test the ability to communicate...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.