8. vCloud Management and Monitoring Examples : 8.2 AMQP Messages : 8.2.2 Example : 8.2.2.5. AMQP Client Configuration
   
8.2.2.5. AMQP Client Configuration
Because AMQP messaging is a polyglot messaging system, the client configuration is implementation specific. Several options exist for consuming the AMQP Exchange for non-blocking messages including using the AMQP plug-in for vCenter Orchestrator or the vCloud Director API. When consuming messages, if your queue is not configured for auto-delete, you must acknowledge the messages sent to the queue when consuming them. The payload of the message is an XML document as a UTF-8 encoded string.
The following simple (Java) example loops over a queue, waiting on the delivery of the next message. ackMessage is a Boolean variable setting whether to acknowledge the message when it is retrieved from the queue.
This example performs the basic steps to acknowledge and process the AMQP messages to obtain the Message Headers and Message Body from a single Message Queue and set the Message Body to a String for subsequent processing. Additional logic could be used to take action based on the Message Header or Message Body.