使用自动确认模式,必须要创建无事务session
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
AUTO_ACKNOWLEDGE:自动确认模式,一旦接收方应用程序的消息处理回调函数返回,会话对象就会确认消息的接收。 一般接收方的做法是调用consumer.setMessageListener()注册消息处理函数。如果该函数返回,代表着一条消息被接受放成功接收, ActiveMQ服务器会认为消息接收成功。函数的返回可以是正常的返回,也可以是因为抛出异常而结束。
接收方代码,多次允许的时候,每次都会接收到1个消息。这是因为消息处理函数没有返回,ActiveMQ会认为消息接收失败。
String url = "tcp://localhost:61616"; String userName = "system"; String password = "manager"; ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(userName, password, url); Connection connection = connectionFactory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); Destination destination = session.createQueue("test_queue"); MessageConsumer consumer = session.createConsumer(destination); // 消息消费者接收消息 consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message msg) { TextMessage message = (TextMessage) msg; try { System.out.println("收到消息:" + message.getText()); while(true) { //throw new JmsException("error return"); } } catch (JMSException e) { e.printStackTrace(); } } });
相关推荐
session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { e.printStackTrace(); } } public void getMessage(String disname){ try { Queue queue = ...
acknowledge us. Permission is NOT granted for the use of any IJG author's name or company name in advertising or publicity relating to this software or products derived from it. This software may ...
If you find it useful or use it in your research, please acknowledge my git repository and cite the original paper [1]. The code depends on OpenCV 2.4+ library and is build via cmake toolchain. ___...
session = connection->createSession(Session::AUTO_ACKNOWLEDGE); } // Create the destination (Topic or Queue) if (useTopic) { destination = session->createTopic("TEST.FOO"); } else { ...
4.4.4 Acknowledge .. 52 4.4.5 7 位地址 ... 53 4.4.6 寄存器写入访问 .. 54 4.4.7 寄存器读取访问 .. 54 4.4.8 高速模式 ... 55 4.4.9 高速传输 ... 55 4.4.10 HS 模式下的数据传输格式 ... 55 4.4.11 F/S ...
3.3.4 "Acknowledge" - Message .........................................................................................20 3.3.5 "Unsolicited Data" - Message...............................................
1 PREFACE. . . . . . . . . ....1.1 Version 1.0 - 1992....1.2 Version 2.0 - 198....1.3 Version 2.1 - 1999....1.4 Purchase of Philips I2C-bus ...7.2 Acknowledge. . . . . . . . . . . . . . . . . . . . . . . 10
Enabled cross trigger interfaces to forward debug acknowledge signal to Watchdog. DLL: SPI-Flash programming for Spansion S25FL256L, fixed. DLL: STM32L031K6 secure chip did not work. Fixed. DLL: STM...
里边是安装后的,包括exe文件,可以尝试使用,美国biapac公司发布的好像是,用来分析脑电心电信号没问题。
* Description : Master Send Acknowledge Single * Input : None * Output : None * Return : None ****************************************************************************** */ void I2C_Ack(void) { ...
考博词汇10000汇总的Excel版 abate v.减轻,减退;废除 aberrant a....异常的;脱离常轨的 ablate v....abortion n....abrade v....acknowledge v.承认;致谢 acknowledgement n.承认,感谢;收到的通知 ......
b) AUTO_ACKNOWLEDGE方式能确认之前收到的所有消息 c) Client_ACKNOWLEDGE方式需要显示调用方法ACKNOWLEDGE方法来显式的确认消息 d) Client_ACKNOWLEDGE方式可以确认所有的消息 参考答案 20) 关于消息Bean事务...
Contents About This Book The MindShare Architecture Series.......................................................................................1 Organization of This Book...............................
Acknowledge 承认 LookDown 向下看 Sad 悲伤 Alert 警告 LookDownBlink 向下看眨眼 Search 寻找 Announce 声明 LookUp 向上看 StartListening 开始聆听 Blink 眨眼 LookUpBlink 向下看眨眼 StopListening 停止...
Acknowledge4.2安装包,包括AckSetup.exe直接运行安装即可。
Users should acknowledge that no liability claims could be made in connection with installing and using this package, in particular the WINGRUB utility. Homepage: ...
19 Acknowledge Frames _______________________________________________________42 20 Radio control state machine __________________________________________________44 21 MAC Security Operations ...
7.2 Acknowledge. . . . . . . . . . . . . . . . . . . . . . . 10 8 ARBITRATION AND CLOCK GENERATION . . . . . . . . . . . . . . . . . . . . . .11 8.1 Synchronization . . . . . . . . . . . . . . . . . ....
They acknowledge the major contributions Fama and French have made to the literature in the past and so studied this new research with great interest. However the debate is set to continue – they ...
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/adaption_...