The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Get your hands off my queue

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jeff Key

Posts: 481
Nickname: jeffreykey
Registered: Nov, 2003

Jeff Key is legally sane, but questionably competent.
Get your hands off my queue Posted: May 12, 2004 8:48 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jeff Key.
Original Post: Get your hands off my queue
Feed Title: Jeff Key
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/jkey/Rss.aspx
Feed Description: Topics revolve around .NET and the Windows platform.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jeff Key
Latest Posts From Jeff Key

Advertisement

Need exclusive read access to an MSMQ queue? .NET gives you an easy way to do this, but a not-so-obvious way to give up the queue. To obtain a “read lock“ on the queue, simply set MessageQueue.DenySharedReceive to true. From the docs:

DenySharedReceive specifies the shared mode of the queue referenced by this MessageQueue. Set DenySharedReceive to true to indicate that only this MessageQueue should have access to peek or receive messages from the queue with the specified Path. If another MessageQueue or another application is associated with the same queue resource, that instance or application will not be able to peek or receive messages, but it can still send them.

If DenySharedReceive is false, the queue is available to multiple applications for sending, peeking, or receiving messages.

Unfortunately, simply setting DenySharedReceive to false didn't allow others to read from the queue. I had to unsubscribe from ReceiveCompleted and close the queue. YMMV.

Read: Get your hands off my queue

Topic: About the Longhorn Community Technical Preview, WinHEC 2004 Build (Build 4074) Previous Topic   Next Topic Topic: New hosted free .NET content management solution

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use