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
- The client sends messages to a queue
- Queue confirms receipt
- Messaging Handler retrieves the message
- Processes the work
- Handler confirms message completely.
Request-Response
- Client sends a message + reply address
- Messaging Handler retrieves the message
- Handler processes the work
- Send a completion response message to the response queue
- Client retrieves response message
Publish-Subscribe
- Subscribers register with queue
- Publisher sends a message to the queue
- The queue confirms the receipt
- Queue forwards message to all subscribers
Public and Private MSMQ
Public:
- Published in Active Directory
- Can query AD to find queues
- Integrate with Windows security
Private:
- Not integrated with AD
- But still available for public use
- 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