Message Queues and Messaging Basics

   

A message is a unit of data sent between two computers. A message can be very simple, consisting of just a string of text, or more complex, possibly involving embedded objects.

Messages are sent to queues. A message queue is a container that holds messages while they are in transit. The Message Queue Manager acts as the middleman in relaying a message from its source to its destination. A queue's main purpose is to provide routing and guarantee the delivery of messages; if the recipient is not available when a message is sent, the queue holds the message until it can be successfully delivered.

Message Queuing, Microsoft's messaging technology, provides messaging and message queue facilities for any application and among any combination of computers that have Microsoft Windows installed, regardless of whether they are on the same network or online at the same time.

A Message Queuing network is any set of computers that are enabled to send messages back and forth to one another. Different computers in the network play different roles in ensuring that messaging proceeds smoothly. Some provide routing information to determine how messages are sent, some hold key information for the entire network, and some simply send and receive messages.

During Message Queuing setup, an administrator makes decisions about which servers can communicate with each other and sets up special roles for specific servers. The computers that make up this Message Queuing network are called sites , and they are connected to one another by site links . Each site link has an associated cost, determined by the administrator, that indicates how quickly messages can be passed across it.

The Message Queuing administrator also sets up one or more computers in the network to act as routing servers. A routing server makes decisions about how a message is delivered by looking at the cost of various site links and determining the quickest and most efficient way to deliver the message across multiple sites.

You do not need to worry about the details of message routing during development, because administrators can tune your Message Queuing network for efficient message delivery.

Types of Queues

There are two main categories of queues: queues that you or other users of the network create, and system queues. The following are queues that lists all types of queues:

  • Public queues are replicated throughout the Message Queuing network, and all the sites connected by the network can potentially access them.

  • Private queues are are not published across the entire network. Instead, they are available on only the local computer that contains them. Only applications that know the full path name or label of the private queues can access them.

  • Administration queues contain are messages acknowledging the receipt of messages sent within a given Message Queuing network. You specify the administration queue you want your MessageQueue components to use, if any.

  • Response queues contain areresponse messages that are returned to the sending application when the destination application receives the message. You specify the response queue you want your MessageQueue components to use, if any.

  • Journal queues optionally are store copies of messages that you send and messages removed from a queue. A single journal queue on each Message Queuing client stores copies of messages sent from that computer. On the server, a separate journal queue is created for each individual queue. This journal tracks messages removed from that queue.

  • Dead-letter queues store are copies of undeliverable or expired messages. If the expired or undeliverable message was a transactional message, it is stored in a special kind of dead-letter queue called a transaction dead-letter queue . Dead letters are stored on the computer on which the message expired. For more information on time-out periods and expired messages, see the section titled "Default Message Properties."

  • Report queues arecontain messages that indicate the route a message took to its destination, and can also contain test messages. There can be only one report queue per computer.

  • Private system queues are a areseries of private queues that store administrative and notification messages that the system needs to process messaging actions.

Most of the work you do in your applications will involve accessing public queues and their messages. However, you will most likely use several different kinds of the system queues in your day-to-day operations, depending on your application's need for journal recording, acknowledgement , and other special processing.

Interacting with Message Queues

Messaging provides a powerful and flexible mechanism for interprocess communication between components of a server-based application. It has several advantages over direct calls between components, including

  • Robustness ” Messages are considerably less affected by component failures than are direct calls between components, because messages are stored in queues and remain there until processed appropriately. Messaging is similar to transaction processing, because message processing is guaranteed .

  • Message prioritization ” More urgent or important messages can be received before less important messages, so you can guarantee adequate response time for critical applications.

  • Offline capabilities ” Messages can be sent to temporary queues and then remain there until they are successfully delivered. Users can continue to perform operations when access to the necessary queue is unavailable for whatever reason. In the meantime, additional operations can proceed as if the message had already been processed, because the message delivery is guaranteed when the network connection is restored.

  • Transactional messaging ” You can couple several related messages into a single transaction, ensuring that the messages are delivered in order, delivered only once, and are successfully retrieved from their destination queue. If any errors occur, the entire transaction is cancelled.

  • Security ” The Message Queuing technology on which the MessageQueue component is based uses Windows security to secure access control, provide auditing, and encrypt and authenticate the messages your component sends and receives.

You must install Message Queuing on your client computer (which in this case is the participating server, not an arbitrary machine with a browser). When you install Message Queuing, you select the primary Message Queuing server to which you want to connect. You cannot view or manipulate queues that reside on another primary Message Queuing server.

Message Queuing can be run in either a domain or a workgroup environment. In the context of Message Queuing, a domain environment includes domain controllers that provide a directory service such as Active Directory, and a workgroup environment is any environment that does not provide such a directory service.

You can create MessageQueue components in both Web applications and Windows applications built with the common language runtime.

Synchronous and Asynchronous Communication

Queue communication is inherently asynchronous, in that messages are sent to a queue and received from a queue in separate processes. In addition, you can perform receive operations asynchronously, in that the person who wants to receive a message can call the BeginReceive method for any given queue and then immediately go on to other tasks without waiting for a reply. This is very different from what is known as synchronous communication .

In synchronous communication, the sender of a request must wait for a response from the intended receiver before performing other tasks. The amount of time that the sender must wait depends entirely on the amount of time it takes for the receiver to process the request and send a response.

Synchronous or asynchronous retrieval of messages is a separate issue from sending messages. Messages are always sent asynchronously.

Message Security

You can help secure the content of messages that you send and receive in the following ways:

  • You can use authentication to verify the source of messages your applications receive.

  • You can use encryption to ensure that unauthorized persons cannot read or use your messages.

  • You can use access control rights to restrict users with ACL-based security and code with Code Access Security from sending messages to, or reading messages from, a particular queue on a computer.

  • You can use auditing to record which users attempt to access Message Queuing objects, the type of operation attempted, and whether that access succeeded or failed.

I plan to add additional information and examples to the Web site at www.UsingASP.net. Look for more information there after you read through this chapter.

Installing Message Queuing

You must have Message Queuing installed on your development computer if you want to work with Message Queues. You can find instructions on installing Message Queuing in your Windows 2000 or Windows NT documentation. When you install, you must specify whether the new primary Message Queuing server you are creating will act as the hub of a new network, an independent client of an existing network, or a dependent client of an existing network. During initial development, you'll create a network with which you'll develop later. You'll join the existing Message Queuing network for your company or workgroup.

   


Special Edition Using ASP. NET
Special Edition Using ASP.Net
ISBN: 0789725606
EAN: 2147483647
Year: 2002
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net