
- Apache ActiveMQ 教程
- Apache ActiveMQ - 主頁
- Apache ActiveMQ - 概述
- Apache ActiveMQ - 環境設定
- Apache ActiveMQ - 功能
- Apache ActiveMQ - 執行代理伺服器
- Apache ActiveMQ - 管理控制檯
- 基於 Apache ActiveMQ 佇列的示例
- Apache ActiveMQ - 製造程式
- Apache ActiveMQ - 消費程式
- Apache ActiveMQ - 測試應用程式
- 基於 Apache ActiveMQ 主題的示例
- Apache ActiveMQ - 釋出程式
- Apache ActiveMQ - 訂閱程式
- Apache ActiveMQ - 測試應用程式
- Apache ActiveMQ 有用資源
- Apache ActiveMQ - 快速指南
- Apache ActiveMQ - 有用資源
- Apache ActiveMQ - 討論
Apache ActiveMQ - 測試應用程式
啟動 ActiveMQ 伺服器
下面讓我們啟動 ActiveMQ 伺服器。轉到資料夾 F:/ → Apache → apache-activemq-5.16.4/bin 並鍵入以下命令。
示例
F:\Apache\apache-activemq-5.16.4\bin>activemq start
輸出
您將看到類似的輸出,並且 ActiveMQ 將開始執行。
... INFO | Apache ActiveMQ 5.16.4 (localhost, ID:DESKTOP-86KD9FC-52669-1645860020983-0:1) started INFO | For help or more information please see: http://activemq.apache.org INFO | ActiveMQ WebConsole available at http://127.0.0.1:8161/ INFO | ActiveMQ Jolokia REST API available at http://127.0.0.1:8161/api/jolokia/
啟動製造程式
在 eclipse 中,右鍵單擊 Producer.java 源,然後選擇“Run As(作為)”>“Java Application(Java 應用程式)”。製造程式將開始執行,並且您將看到如下輸出 −
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Enter message:
啟動消費程式
在 eclipse 中,右鍵單擊 Consumer.java 源,然後選擇“Run As(作為)”>“Java Application(Java 應用程式)”。消費程式將開始執行,並且您將看到如下輸出 −
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
傳送訊息
在製造程式控制臺視窗中,鍵入 Hi 並按 enter 鍵傳送訊息。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Enter message: Hi
接收訊息
在消費程式控制臺視窗中驗證訊息是否已接收。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Received = Hi
將退出資訊作為訊息傳送,以終止製造程式和消費程式控制臺視窗會話。
驗證
現在在瀏覽器中開啟 http://127.0.0.1:8161/admin/。它將詢問憑據。使用“admin/admin”作為使用者名稱/密碼,它將載入您可以在其中檢查佇列以檢視狀態的 ActiveMQ 管理控制檯。它顯示已入列並傳送了 2 條訊息。

廣告