在JMS API文档中,它说:
public Message receive() throws JMSException
Receives the next message produced for this message consumer. This call blocks indefinitely until a message is produced or until this message consumer is closed.
If this receive is done within a transaction, the consumer retains the message until the transaction commits.
我是一个有用的助手,可以翻译文本。
这里有三个问题: 1. 在代码中,我们需要使用while循环来接收消息吗?例如:
while(true){
Message msg = queue.receive();
....
}
what is the transaction setting ? how to commit a transaction ? like this:
boolean transacted = false; session = connection.createQueueSession(transacted, Session.AUTO_ACKNOWLEDGE);
receiveNoWait() has transaction support ? how to use it ?
谢谢