Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF MSMQ
I've created a public queue and sent some messages to the queue using a windows service application. The sending application executes on the same server as the queue (i.e. this is a local queue).
 
After restarting the server, all of the queued messages were purged. Is there any way to persist these messages after a server restart?
Posted 21-Mar-13 5:52am
Comments
Sergey Alexandrovich Kryukov at 21-Mar-13 10:57am
   
Why would you restart the service if some messages are not yet processed then?
—SA
saumil.sapariya at 22-Mar-13 0:54am
   
Services restarted Automatically when Application pools are recycled. plz have any suggestion? post on it. Thanks :)
Sergey Alexandrovich Kryukov at 22-Mar-13 1:50am
   
Well, a service handles some system events; including all cases when it is stopped. You can use it for completion of queue processing...
—SA
saumil.sapariya at 22-Mar-13 6:19am
   
Below Case (I noticed following case service restarted and first message lost-
(not reach a MSMQ queue))
1) When WCF Service Deploy at time first message send it lost.
2) When Service.svc file load at time message lost.
3) When Pool recycled at this time first message lost.
 
I received a message form queue it's separate thread it's continue running.
Prasad Khandekar at 21-Mar-13 11:31am
   
Please refer to this (http://msdn.microsoft.com/en-us/library/ms978430.aspx) libray article to know more about reliable messaging with MQ.
saumil.sapariya at 22-Mar-13 0:59am
   
http://stackoverflow.com/questions/14911644/msmq-lost-first-message
 
my sample code such as above stackover flow question.
Can i achieve simple queue? or Will I need transaction queue for recovery of loss message??
plz post if u have any suggestion?
Thankx :)

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

To achieve this you have to mark the messages as Recoverable. By default, MSMQ messages are only held in memory, but Recoverable messages are backed to disk to enable reliable MSMQ Messaging.
 
using System.Messaging;
 
Message recoverableMessage = new Message();
recoverableMessage.Body = "Sample Recoverable Message";
recoverableMessage.Recoverable = true;
MessageQueue msgQ = new MessageQueue(@".\$private\Orders");
msgQ.Send(recoverableMessage);
 
Details can be found at the below link:-
 
http://msdn.microsoft.com/en-us/library/ms978430.aspx#bdadotnetasync2_topic2[^]
  Permalink  
Comments
saumil.sapariya at 22-Mar-13 9:23am
   
I tried for this same code. I also set Message queue Acknowledge Property but Message Acknowledge gave send message true but message don't send to Queue (Message Lost).Acknowledge message or MSMQ trace also send a message to Particular Queue but Queue not receiver a message Is there any Error Or Exception?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 280
1 Jochen Arndt 150
2 Kornfeld Eliyahu Peter 120
3 PIEBALDconsult 110
4 Richard MacCutchan 105
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100