Sun GlassFish Message Queue 4.4 Developer's Guide for C Clients

ProcedureTo Set Up a Message Queue C Client to Consume Messages Synchronously

  1. Call the MQCreateProperties function to get a handle to a properties object.

  2. Use one or more of the MQSet...Property functions to set connection properties that specify the name of the broker, its port number, and its behavior.

  3. Use the MQCreateConnection function to create a connection.

  4. Use the MQCreateSession function to create a session and to specify its receive mode. Specify MQ_SESSION_SYNC_RECEIVE for a synchronous session.

  5. Use the MQCreateDestination function to specify a destination on the broker from which the consumer is to receive messages. The destination name you specify must be the same as the name of the physical destination.

  6. Use the MQCreateMessageConsumer function or the MQCreateDurableMessageConsumer function to create a consumer.

  7. Use the MQStartConnection function to start the connection.

  8. Use one of the MQReceiveMessage... functions to start message delivery.