String msgSel = new String ("consumer='"+user+"'"); //设置过滤器
if (isDurable()) //是否持久性订阅
{
topicSubscriber = getTopicSession(true).createDurableSubscriber(getSubscribeTopic(), getDurableName(), msgSel, false);
}
else
{
topicSubscriber = getTopicSession(true).createSubscriber(getSubscribeTopic(), msgSel, false);
}
本小段程序的含义是选折出消息队列中消息属性consumer值等于变量user的消息
设置消息属性如下:
textMessage.setStringProperty("consumer", consumer);
if (isDurable()) //是否持久性订阅
{
topicSubscriber = getTopicSession(true).createDurableSubscriber(getSubscribeTopic(), getDurableName(), msgSel, false);
}
else
{
topicSubscriber = getTopicSession(true).createSubscriber(getSubscribeTopic(), msgSel, false);
}
本小段程序的含义是选折出消息队列中消息属性consumer值等于变量user的消息
设置消息属性如下:
textMessage.setStringProperty("consumer", consumer);
解决方案 »
- 类似getServletConfig(),getServletName()这样的出现在servlet中的方法为什么前面都不用加对象名?它们的调用者是谁?困惑..
- 求高人指点--4年J2SE 桌面开发如何成功转向J2EE
- 请问CORBA用DSI方式编写服务器如何设置数组和结构类型的参数和返回值
- 很奇怪的java问题
- webwork action 自动执行两次,奇怪的问题!
- 在多线程环境下,static方法是不是必须用同步?
- 请教一条EJB-QL?
- 急,java用来做什么。
- 请教有没有解析XML Schema的程序包
- apache mina2过滤器的问题!
- 使用JB2005做PORTAL的程序,有谁会做,请教!!!!!!!!
- 用jdbc删除记录后(commit了),在ejb(cmp)中插入记录报主键存在错,难道两者不能混用?
receiver=session.createReceiver(message Queue,"JMSPriority>4")
2、基于消息属性,要求发送者发送时指定属性,以发送string为例
发送者指定属性:msg.setStringProperty("user","abc");
接受者获取:msg.getStringProperty("user");