-------------------------------------------------------------------- SearchWin2000's Developer Tip -------------------------------------------------------------------- TODAY'S DEVELOPER TIP: Integrating messaging in .Net ==================================================================== SPONSORED BY: SurfControl ==================================================================== "I was one of the 750,000 SirCam victims. One employee let the virus in by accessing his personal email account over the Web. I had no control then. But now I'm using SuperScout Web Filter to block access to Hotmail, Yahoo...actually all Web-based email sites. They say SirCam may never go away, but it might if everyone was protected by SuperScout." -Network Manager. FREE 30-Day Trial: http://www.surfcontrol.com/trial/ZMTRTTAT0912 ==================================================================== "Integrating messaging in .Net" By Dan Fox Microsoft's .Net architecture offers lots of advantages. This tip, excerpted from InformIT, discusses the ability to allow for applications to process requests asynchronously, which will allow for greater scalability and reliability in systems. -------------------------------------------------------------------- One of the particularly effective ways to increase the scalability and reliability of a distributed application is to move from a model where application requests are processed synchronously to one where some or all of the requests are processed asynchronously. Microsoft includes the Microsoft Message Queue (MSMQ) product as a service in their server operating systems to provide the queueing infrastructure for applications to create and manipulate queues, in addition to sending to and receiving messages from those queues. MSMQ is not installed by default in Windows 2000 Server. You can do so by using the "Configure Your Server" utility found in the Administrative Tools group and looking under the Advanced option. Not surprisingly, the Services Framework provides a namespace, System.Messaging, which encapsulates the functionality of MSMQ. This section will examine the System.Messaging namespace, first in how queues are programmatically referenced and administered and secondly in how messages are serialized, sent and received by application programs. Although the System.Messaging namespace contains over 20 classes, the central class is MessageQueue. This class contains both shared and instance methods to allow you to query for queues contained on a particular machine or across the network in addition to manipulating individual queues. At the most basic level, the set of shared members include Create, Delete, Exists and several methods prefixed by Get that allow you to query for queues. For example, the following code uses the Exists method to determine if a queue identified by the mstrPath variable exists and if not creates it. In either case the queue is then referenced by creating an instance of MessageQueue and passing in the identifier of the queue: If Not MessageQueue.Exists(mstrPath) Then MessageQueue.Create(mstrPath, False) End If Dim oQueue As MessageQueue oQueue = New MessageQueue(mstrPath, False) Note that in the Create method, the second argument indicates whether the queue should be transactional, in other words use the Microsoft Distributed Transaction Coordinator (MSDTC) service to ensure message delivery. And, in the constructor of the MessageQueue object, the second argument specifies whether the first application to access the queue receives exclusive access to it. Note that creating a new MessageQueue object using the New keyword does not create a new queue, it simply references one that already exists. You'll notice that the path passed into these methods is simply a string that identifies the queue. In fact, the string can take one of three forms: The path to the queue as returned by the Path property of the MessageQueue object. This is the typical approach in the form MachineNameQueueName. For private queues, it is MachineNameprivate$QueueName. System queues such as Deadletter$ and Journal$ can also be accessed this way. The format name returned by the FormatName property prefixed with "FormatName:" This is typically used for offline access to queues. The label of the queue as returned by the Label property prefixed with "Label:" The Label property can be set for a queue to provide a description. Using the Label is not recommended since labels are not required to be unique and can thus cause exceptions to be thrown when sending messages or referencing a queue. In addition to creating and deleting queues, the MessageQueue class also provides query and enumeration methods to list the queues on a machine and the message within the queue. -------------------------------------------------------------------- To read this entire tip, click the link below to visit InformIT. You have to register there, but the registration is free. [http://www.informit.com/myinformit/login/index.asp?session_id={66E24744-03A8-4A5C-8221-054954A9355E}&t={6373D50E-EF0B-4084-B8A7-032653E262E2}&n={25CDEA72-27D2-4A46-8AC7-BCA212456568}] ==================================================================== LAST CHANCE TO WIN! ==================================================================== September's tip of the month contest is winding down. Don't miss your chance to win this month's very cool prize - an iBOT Firewire desktop video camera with microphone! Check out the prize and submit your tip today at http://searchwin2000.techtarget.com/tipsHallOfFame/0,289489,sid1_prz758210_cts758207,00.html. ==================================================================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ FREE ACTIVE DIRECTORY NEWSLETTER! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Register to receive searchWin2000's monthly Active Directory tip! Active Directory is perhaps the most complicated part of the Windows 2000 architecture, and the foundation for Exchange 2000 among other programs. Our monthly Active Directory tips will help you with the planning, administration and maintenance of AD services within your distributed networking environments. Don't wait to begin receiving these helpful and timesaving expert tips. Register to receive this newsletter at http://searchwin2000.techtarget.com/register/1,,sid1,00.html. ==================================================================== If you would like to sponsor this or any TechTarget newsletter, please contact Mike Kelly at mailto:[EMAIL PROTECTED]. ==================================================================== If you no longer wish to receive this newsletter simply reply to this message with "REMOVE" in the subject line. Or, visit http://searchWin2000.techtarget.com/register and adjust your subscriptions accordingly. If you choose to unsubscribe using our automated processing, you must send the "REMOVE" request from the email account to which this newsletter was delivered. Please allow 24 hours for your "REMOVE" request to be processed.
