MSMQ Exchange Connector: Book Server Application

The Book Server sample application uses the MSMQ Exchange Connector to pass messages between a Microsoft® Exchange user and an MSMQ application. In this application, the Exchange user requests a query, the MSMQ application performs the query, and the results of the query are sent back to the Exchange user.

How Book Server Works

Here is the step-by-step process that Book Server uses to perform its query.

  1. Using Microsoft Exchange, the Microsoft Exchange user enters the search criteria and submits the query mail, which is preaddressed to a recipient called Book Server. The mail's MSMQ-typed address is set to the label of the application input queue of the sample MSMQ application booksrvr.
  2. The Exchange Connector receives the form from Exchange (because the recipient is an MSMQ-typed recipient), translates it into an MSMQ mail message, and sends it to the application input queue of the sample MSMQ application.
  3. The sample MSMQ application (booksrvr) retrieves the message from the application input queue, calls MQMailParseBody to parse the body of the message into a mail structure, and finds the values of the query fields from the structure and performs the query.
  4. Once the query is complete, a reply form is sent to the Exchange Connector. The reply form is created by including the results of the query, who is sending the results (in this case the booksrvr application), and who will receive the results (the sender of the original mail) in a new mail structure. After the structure is filled in, a call to MQMailComposeBody creates a message body that is then sent to the Exchange Connector's server input queue.
  5. The Exchange Connector retrieves the message from the queue, translates it into mail, and submits it to the Exchange user who requested the query.
  6. The Exchange user can then retrieve the mail from the Inbox and view the results of the query.
    To Run Book Server
  1. Build the sample MSMQ application.
  2. Ask your Microsoft Exchange administrator to install the MSMQ Exchange Connector from the MSMQ CD.
  3. From the booksrvr directory, the administrator must install the forms bookfrm.efp and bookres.efp into your Exchange system.
  4. Your Exchange administrator must add a custom recipient named "Book Server" with the address-type MSMQ and whose address is "booksrvrq." It must not be a rich-text recipient.
  5. Run booksrvr.exe (make sure MSMQ is running). Type "booksrvr booksrvrq" in the command line. The argument booksrvrq is the label of the queue that the booksrvr application will use as its input queue. This label should be identical to the address of the "Book Server" custom recipient that your Exchange administrator entered.
  6. Send the query. In your mail client, open the form named "Book Search". Fill in the appropriate fields and submit the form.
  7. Verify the query results. After a short time, you should receive a result form sent by the sample booksrvr application with the results of the query.