ActiveMQ用于协同标绘时注意的事项

来源:互联网 发布:perl python 哪个好 编辑:程序博客网 时间:2024/05/21 08:59

在做地图协同时,消息通过MQ接受到了,但是没有发送出去,原因是没有初始化订阅模式,初始化传输信道。

如:初始化:ReceiveMessage.doReceive(); 
//给我们定义的consumer对象指定一个信道,我们定义了两种信道,在services-config.xml文件中,此处选用my-streaming-amf 
consumer.subscribe(); 

在加载信息的传输内容及配置:<!--消息的传递-->
<!-- 将非可视元素(例如服务、值对象)放在此处 -->  
<!--此处定义一个consumer,需要使用它来订阅消息,订阅了以后才能接收到后台发来的数据。这里的关键是要定义destination,destination的值和后台messaging-config.xml定义的  destination的值相同-->  
<s:Consumer  channelSet="{cs}"  id="consumer" destination="chat" fault="consumer_faultHandler(event)"  message="consumer_messageHandler(event)"/>  
<!--此处定义个接收消息的类,与后台的接收消息的POJO对应,通过它来定义consumer和调用监听方法-->  
<s:RemoteObject id="ReceiveMessage" channelSet="{amf_channel}" destination="Reciver"  
fault="ReceiveMessage_faultHandler(event)"/> 
<!--此处定义个发送消息的类,与后台的发送消息的POJO对应,通过它向ActiveMQ发送消息-->  
<s:RemoteObject id="Send" channelSet="{amf_channel}" destination="Sender"  
fault="Send_faultHandler(event)"/>  

<s:AMFChannel id="myamfChannel"  
  url="http://192.168.1.112:8080/springmq/messagebroker/amf"/>  
<s:ChannelSet  id="amf_channel" channels="{[myamfChannel]}"/>  

<s:ChannelSet id="cs">  
<s:AMFChannel   url="http://192.168.1.112:8080/springmq/messagebroker/amf"/>  

</s:ChannelSet> 

0 0
原创粉丝点击