ActiveMQ的使用及整合spring的使用例項

2021-08-16 17:21:09 字數 1419 閱讀 7512

主要講述的是使用的一些步驟,關於兩種訊息不提供解釋。

/**

* 傳送點對點的訊息

* @throws exception

*/public void sendqueuetest() throws exception

/**

* 發布訊息

* @throws exception

*/public void sendtopictest() throws exception

/**

* 接收點對點的訊息

* @throws exception

*/public void getqueuetest() throws exception catch (jm***ception e)

}});

system.in.read();

//第九步:關閉資源

consumer.close();

session.close();

connection.close();

}

/**

* 訂閱訊息

* @throws exception

*/public void gettopictest() throws exception catch (jm***ception e)

}});

system.in.read();

//第九步:關閉資源

consumer.close();

session.close();

connection.close();

}

//jms提供的activemq的工具類

@autowired

private jmstemplate jmstemplate;

//這個是發布/訂閱模式

@resource

private destination topicdestination;

//將新增商品的訊息新增到佇列

jmstemplate.send(topicdestination, new messagecreator()

});

/**

* 訊息佇列的***

* @author adrain

* */

public class searchmessagelistener implements messagelistener

} catch (exception e)

}}

ActiveMQ 與Spring的整合

一 簡單整合 1 新增依賴 org.apache.activemqgroupid activemq coreartifactid 5.7.0version dependency org.springframeworkgroupid spring jmsartifactid 5.1.5.release...

activemq基本介紹及使用

一 jms概念 jms即j a訊息服務 j a message service 應用程式介面,是乙個j a平台中關於面向訊息中介軟體 mom 的api,用於在兩個應用程式之間,或分布式系統中傳送訊息,進行非同步通訊。j a訊息服務是乙個與具體平台無關的api,絕大多數mom提供商都對jms提供支援。...

iOS RabbitMQ整合及使用

ios rabbitmq整合及使用 rabbitmq是流行的開源訊息佇列系統,用erlang語言開發。rabbitmq是amqp 高階訊息佇列協議 的標準實現。如果不熟悉amqp,直接看rabbitmq的文件會比較困難。不過它也只有幾個關鍵概念,這裡簡單介紹。rabbitmq的結構圖如下 幾個概念說...