如何在 Transaction 中接收队列的多条消息并在某些时候回滚,以便使用该队列中消息的其他程序可以接收消息?
我试图以某种方式这样做:
ObjectMessage obj = (objectMessage) consumer.receive();
ObjectMessage obj2 = (ObjectMessage) consumer.receive(10000);
if(obj2 == null) session.rollback(); //if we haven't received thesecond message after 10 second, also the first message should be rolled back so other consumerprograms can take it.