我想从我的队列中轮询消息,但需要固定金额。
QueueReceiver receiver = new QueueReceiver("tcp://localhost:61616", "admin", "admin");
try {
receiver.startReceiving("KBC");
} catch (JMSException e1) {
e1.printStackTrace();
}
我想做的是例如:
receiver.setAmountOfMessages(5);
或
receiver.startReceiving("KBC",5);
PS:我使用ActiveMQ