An application uses a requestor to send a request message and then wait for, and receive, the reply.
Many messaging applications are based around algorithms that send a request message and then wait for a reply. XMS provides a class called Requestor to help with the development of this style of application.
To create a requestor, an application calls the Create Requestor constructor of the Requestor class, specifying as parameters a Session object and a Destination object that identifies where request messages are to be sent. The session must not be transacted nor have an acknowledgement mode of XMSC_CLIENT_ACKNOWLEDGE. The constructor automatically creates a temporary queue or topic where reply messages are to be sent.
After creating a requestor, the application can then call the Request method of the Requestor object to send a request message and then wait for, and receive, a reply from the application that receives the request message. The call blocks until the reply is received or until the session ends, whichever is the sooner. The requestor expects only one reply to each request message.
When the application closes the requestor, the temporary queue or topic is deleted. The associated session, however, does not close. In this respect, XMS behaves differently compared to JMS.