Designed for receiving messages from a queue on the server from the specified service.
function Receive(Conversation: TMSConversation = nil): boolean;
The Receive method is designed for receiving messages from a queue on the server from the specified service. You can get access to the current message using the CurrentMessage property.
If the Receive method returns False, there are no more messages on the server. So, the CurrentMessage will be nil.
In this mode, after calling the Receive method, up to FetchRows messages are received from the server. The CurrentMessage property will point to the first message of the received ones. The subsequent calls to Receive will not lead to the server round trips, while there are messages in cache. This mode is enabled by default.
If the Conversation parameter is assigned, only messages of this conversation will be received.
In this mode messages from the server are received in a separate thread and are put into a local queue. Calls to Receive itself do not lead to the server round trips.
The Conversation parameter can not be used in the asynchronous mode.
Example for using Receive in synchronous mode:
while MSServiceBroker.Receive do Process(MSServiceBroker.CurrentMessage);