Receive subscriptions

 

Subscribers must be able to read the subscriptions that are delivered to them, as in the following code:

// receive message
TextMessage m = (TextMessage) sub.receive();
System.out.println("Message Text = " + m.getText());
m = (TextMessage) subA.receive();
System.out.println("Message Text = " + m.getText());

This fragment of code performs a get-with-wait, which means that the receive call blocks until a message is available. Alternative versions of the receive call are available (such as receiveNoWait). For details, see MQTopicSubscriber.


uj24700_