Linux,activemq-cpp之消息过滤器

activeMQ-cpp中消息过滤器,在发送消息的producer.cpp中,对message进行属性设置,

在执行producer->send(message);语句前

设置完消息属性

message->setStringproperty(filt-key,filt-value);

在consumer.cpp中,在接收消息前设置消息过滤条件:

consumer=session>createConsumer(destination,msgfilter);

msgfilter是将key和value用等号连接起来的字符串:如filt-key是filter,filt-value是1111,则msgfilter是filter=1111;

在IDE中编译运行发送接收带过滤信息的程序时,每次发送消息前必须更改过滤消息即filt-key和filt-value;

同时接收消息方也要更改msgfilter,才能实现接收。

关于activemq-cpp发送和接收消息的程序可以参考http://blog.csdn.net/chenxun_2010/article/details/52709277

posted @ 2017-07-26 15:31  Mouming_Ning  阅读(511)  评论(0编辑  收藏  举报