<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx</link><description>MSMQ simply provides wonderful capabilities when it comes to building asynchronous messaging based applications. You typically run into situations where two applications exchange messages through a queue &amp;#8211; one application sends messages to a known</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#1228588</link><pubDate>Wed, 03 Oct 2007 14:16:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1228588</guid><dc:creator>Sloan</dc:creator><description>&lt;p&gt;//Quote//&lt;/p&gt;
&lt;p&gt;I am using the same code and created windows services in my local system but if i run my windows service to receive the message. Access denaid the &amp;nbsp;error message i got.&lt;/p&gt;
&lt;p&gt;Can u specify the the format name for the Queue Path. Or any security setting has to be enabled.&lt;/p&gt;
&lt;p&gt;//End Quote&lt;/p&gt;
&lt;p&gt;You have to go thru &amp;quot;Manage Computer&amp;quot; and find the Queue. &amp;nbsp;And give permissions ON THE QUEUE...to the &amp;quot;SYSTEM&amp;quot; account (the SYSTEM account local to that computer).&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t have to do &amp;quot;Full Control&amp;quot;, but Send/Receive are necessary. &amp;nbsp;I usually give Get/Set Permissions as well.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1228588" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#1094439</link><pubDate>Wed, 08 Aug 2007 01:55:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1094439</guid><dc:creator>JM</dc:creator><description>&lt;p&gt;I worte a Q listener as a window service, it is working for read the local transactional Q. But when I cluster the MSMQ, the Q listenser service can not read the Q any more.&lt;/p&gt;
&lt;p&gt;any idea why?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1094439" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#941210</link><pubDate>Mon, 04 Jun 2007 02:08:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:941210</guid><dc:creator>Filip</dc:creator><description>Nice code, would you be able to provide an example of the test class as well on how to call this? (Sorry, I&amp;#39;m a c# beginner)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=941210" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#628013</link><pubDate>Thu, 01 Mar 2007 05:11:25 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:628013</guid><dc:creator>Rahul</dc:creator><description>&lt;p&gt;I am using the same code and created windows services in my local system but if i run my windows service to receive the message. Access denaid the &amp;nbsp;error message i got.&lt;/p&gt;
&lt;p&gt;Can u specify the the format name for the Queue Path. Or any security setting has to be enabled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=628013" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#367521</link><pubDate>Sat, 02 Dec 2006 14:48:11 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:367521</guid><dc:creator>Manoj G</dc:creator><description>&lt;p&gt;Hi Akshay,&lt;/p&gt;
&lt;p&gt;Transactional Receive should solve your problem.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Manoj&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=367521" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#358305</link><pubDate>Fri, 01 Dec 2006 11:50:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:358305</guid><dc:creator>Dharan Prakash</dc:creator><description>&lt;p&gt;Hi Manoj,&lt;/p&gt;
&lt;p&gt;Can you please give me an answer or references for Akshay's question? i.e&lt;/p&gt;
&lt;p&gt;Server A and Server B are listening to the same queue, will both the servers recieve an event when a messge arrives on the queue. Yes they would. - How can I ask one of the servers to process and the other to stand down... &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=358305" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#131940</link><pubDate>Mon, 18 Sep 2006 21:56:47 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:131940</guid><dc:creator>sloan</dc:creator><description>Ravi, I was able to put the fix in this way: In the OnPeekCompletedMethod .. I added the following (extra exception handling) code: catch (MessageQueueException msmqex) { switch ( (int)msmqex.MessageQueueErrorCode ) { case -1073741536: Console.WriteLine(&amp;quot;Msmq Error -1073741536 : Sleeping, and then ReListening&amp;quot;); System.Threading.Thread.Sleep(3000); StartListening(); break; default: trans.Abort(); throw msmqex; //break; } } catch { trans.Abort(); } The issue is that there is a missing enum value for -1073741536 See this url: http://www.koders.com/csharp/fidE632059BF610D9D912C019A96DCF7A2DD76C847F.aspx&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=131940" width="1" height="1"&gt;</description></item><item><title>Wow. Thanks!</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#105435</link><pubDate>Fri, 21 Jul 2006 21:10:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:105435</guid><dc:creator>sloan</dc:creator><description>manoj g, &lt;br&gt;&lt;br&gt;thanks.. that really, really helps with my msmq development.&lt;br&gt;&lt;br&gt;I added one overloaded constructor.... since I binary format my objects. (below)&lt;br&gt;(and theres a small spelling error: FireReceiveEvent)&lt;br&gt;&lt;br&gt;but minus my caveat, this thing works great.&lt;br&gt;&lt;br&gt;There's probably a hole with .. if you use the overload and set the Types[] , so don't trust my implementation too far.&lt;br&gt;&lt;br&gt;		public MSMQListener(string queuePath)&lt;br&gt;		{&lt;br&gt;			this.ConstructorCommon(queuePath);&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		private void ConstructorCommon(string queuePath)&lt;br&gt;		{&lt;br&gt;			_queue = new MessageQueue(queuePath); &amp;nbsp; &amp;nbsp;&lt;br&gt;&lt;br&gt;			&lt;br&gt;			//non manoj stuff//MessageQueue.EnableConnectionCache = false;			 &lt;br&gt;			//non manoj stuff//this._queue.SetPermissions(&amp;quot;Everyone&amp;quot;, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		public MSMQListener(string queuePath , System.Messaging.IMessageFormatter formatter)&lt;br&gt;		{&lt;br&gt;			this.ConstructorCommon(queuePath);&lt;br&gt;			this._queue.Formatter = formatter; // Customize the formatter type&lt;br&gt;		}&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=105435" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#102903</link><pubDate>Tue, 27 Jun 2006 11:44:34 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:102903</guid><dc:creator>Ravi</dc:creator><description>Hi,&lt;br&gt;&lt;br&gt;i am tryig to do an async peek, by calling BeginPeek, the Peek Complete event get triggered immediatly after a call to BeginPeek, even though the Queue is empty.&lt;br&gt;and when endPeek is called, it throws an exception, with no message, but, it has a MessageQueueErrorCode : 0xC0000120&lt;br&gt;&lt;br&gt;I was getting this exception.&lt;br&gt;Then after Searching found ur code. then again i am getting the same exception. &lt;br&gt;Any Idea? &lt;br&gt;&lt;br&gt;Regards&lt;br&gt;B, Ravi Shankar&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=102903" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#92535</link><pubDate>Tue, 25 Apr 2006 14:45:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:92535</guid><dc:creator>akshay</dc:creator><description>Thats cool... &lt;br&gt;I was looking at creating a MSMQ listner... This will help a lot. &lt;br&gt;&lt;br&gt;One question I have : Is can you share any ideas; if I wish to create multiple listener to the same queue, is there are way to synchronize these listners sitting on different machines... &lt;br&gt;i.e. &lt;br&gt;Server A and Server B are listening to the same queue, will both the servers recieve an event when a messge arrives on the queue. Yes they would. - How can I ask one of the servers to process and the other to stand down... &lt;br&gt;&lt;br&gt;Any Ideas ??? &lt;br&gt;&lt;br&gt;Thanks&lt;br&gt;Akshay.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=92535" width="1" height="1"&gt;</description></item></channel></rss>