Messaging in .NET - ablealias/asp.net GitHub Wiki

Message Queues - The asynchronous communication which decouples the components of an application.

MSMQ (Microsoft Message Queuing) - MSMQ is message queuing for Windows, and it's available as a component of Windows on the Desktop and Server editions and it runs in the background as a Windows service. MSMQ can work in isolation on individual machines or it can take advantage of features in Active Directory to provide security so accessing can be locked down to certain accounts or user groups and discoverability. So, queues can be published to Active Directory, and clients can search for them without needing to know the actual host address. MSMQ is a well-specified messaging system, which supports the patterns Fire-and-Forget, Request-Respose and Publish-Subscribe, and it has more advanced functionality.

Messaging Patterns - Fire-and-Forget, Request-Response, Publish-Subscribe

Fire-and-Forget

  1. The client sends messages to a queue
  2. Queue confirms receipt
  3. Messaging Handler retrieves the message
  4. Processes the work
  5. Handler confirms message completely.

Request-Response

  1. Client sends a message + reply address
  2. Messaging Handler retrieves the message
  3. Handler processes the work
  4. Send a completion response message to the response queue
  5. Client retrieves response message

Publish-Subscribe

  1. Subscribers register with queue
  2. Publisher sends a message to the queue
  3. The queue confirms the receipt
  4. Queue forwards message to all subscribers

Public and Private MSMQ

Public:

  1. Published in Active Directory
  2. Can query AD to find queues
  3. Integrate with Windows security

Private:

  1. Not integrated with AD
  2. But still available for public use
  3. Security features not available.

Private Queue Addresses

PATH

{machine}\private$\{queueName}

example for local machine: .\private$\unsubscribe

example for remote machine: SC-MQ-01\private$\unsubscribe

DIRECT

DIRECT={protocol}:{address}\private$\{queueName}

Exmaple: DIRECT=TCP:192.168.2.140\private$\unsubscribe