具有receiveNoWait()的消息选择器 [英] Message selector with receiveNoWait()

查看:410
本文介绍了具有receiveNoWait()的消息选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于同步过程,消息选择器也将与receiveNowait()方法一起使用.它与receive()方法一起使用,但想知道IBM mq的receiveNoWait. 创建使用者时,添加了消息选择器.

Will message selectors work with receiveNowait() method too for synchronous process. it works with receive() method but wanted to know for receiveNoWait for IBM mq. Message selector is added while creating consumer.

我已经用receiveNowait()方法进行了测试,选择器不起作用.我不知道问题出在我的选择器或receivenowait方法上.以下是我使用的选择器:

EDIT 1: I have tested with receiveNowait() method, and the selector is not working. I don't know the problem is with my selector or the receivenowait method. following is the selector I have used:

String messageSelector = "JMSTimestamp <= " + System.currentTimeMillis() - 180000;
 receiver = (MessageConsumer) session.createConsumer(replyQueue, messageSelector);

表示接收方只需要接收比当前时间早3分钟的消息. 任何人都可以找出问题所在.

that means, receiver has to receive the messages only which are 3 minutes older than current time. Can anyone figure out what is the issue.

在完成测试之后,我发现选择器存在问题,选择器表达式中JMSTimeStamp的正确用法是什么?

EDIT 2: after complete testing , i have found that problem is with selector, what can be the correct usage of JMSTimeStamp in selector expression?

推荐答案

receive(),receive(long timeout)和receiveNoWait()在交付内容方面应该完全相同.实际上,有几种实现是通过调用另一种方法来实现的.

receive(), receive(long timeout) and receiveNoWait() should work exactly the same in terms of what is delivered. In fact several implementations implement one by calling another method.

这篇关于具有receiveNoWait()的消息选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆