130 likes | 243 Vues
Message Queuing Middleware. Message queuing is asynchronous communication Most distributed apps use synchronous communication Sender must wait for response Can require more hardware to handle peak workload With queuing, make request and then move on
E N D
Message Queuing Middleware • Message queuing is asynchronous communication • Most distributed apps use synchronous communication • Sender must wait for response • Can require more hardware to handle peak workload • With queuing, make request and then move on • No guarantee on when receiver will process request • Usually good response time
Fundamental Challenges • Conventional communication technologies require Tx and Rx application: • Online at the same time • Able to communicate over network at the same time • Reality is: • Apps do not run at same time • WANs not always reliable and available • Change that requires other side to change not practical • Distributed transactions can impact availability and performance
Role of Message Queuing Middleware • MQM satisfies four important conditions • No simultaneous connection is required • Extremely strong request and response delivery guarantees • Request and responses can be translated and reformatted • Business models must promote adoption by ISVs
Communicating Via MQM • Applications communicate via messages • MQM provider keep messages in queues
MQM Benefits to Programmers • Applications can send to non running or unreachable apps • MQM will deliver waiting messages when app is available • MQM uses proven technologies to provide reliability for mission critical apps • Providers can reroute messages around failure points
MQM and Distributed Applications • Examine MQM in a series of scenarios • Store and forward communication • Defensive communication • Concurrent communication • Journaled communication • Connectionless communication
Downside of MQM • Distributed communications falls into three categories • A response is required immediately and no response will cause application to hang • A response is needed in time period set by business policy • Sender trusts the system to deliver and no response is required
MSMQ Objects • Objects include Machines, Queues, Messages • Using the MSMQ API, you can: • Create queue objects • Locate queue objects • Open and delete queue objects • Set and get queue object properties • Send and receive message objects • Get machine object properties
Types of Queues • Application Created Queues • Message • Administration • Response • MSMQ or System Created Queues • Journal • Dead Letter • Report
MSMQ Messages • Most messages contain application data • Other are MSMQ generated, acknowledgement • Each message contains an MSMQ generated identifier • Property also identifies message
MQM Transactions • This model shows two transactions • One to send messages to Queue • One to retrieve message from Queue
Using the MSMQ API Functions • Creating a Queue • Locating a Public Queue • Opening a Queue • Closing a Queue • Deleting a Queue • Sending Authenticated Messages • Sending Messages to a Queue • Sending Messages that Request Acknowledgments • Sending Messages that Request a Response • Sending Private Messages • Sending Messages Using an Internal Transaction • Sending Messages Using an MS DTC External Transaction • Reading Messages Synchronously • Reading Messages Asynchronously • Reading Messages Using a Cursor • Reading Messages in a Dead Letter Queue • Reading Messages in a Machine Journal • Reading Messages in a Queue Journal • Returning an Acknowledgment Message by a Connector Application • Retrieving a Queue's Properties • Setting a Queue's Properties Using API Functions • Setting Access Control Security for a Queue • Using Transactions