廣播

功能 > ActiveMQ Classic 即時 > 廣播

ActiveBlaze 提供快速、可靠的點對點訊息傳遞基礎設施,以滿足高效能和協同應用程式的需求。
使用通道的基本構建模組,存在一個用於不同問題領域的功能層次結構,每個層次結構都是前一個層次的超集合。

BlazeChannel 支援在主題上進行廣播 - 可以使用可靠的多點傳播或點對點傳播。

要使用 BlazeChannel,請從工廠建立一個。

import org.apache.activeblaze.*;
...
BlazeChannelFactory factory = new BlazeChannelFactory();
BlazeChannel sender = factory.createChannel();
//start the channel and send a message
sender.start();

String destination = "foo.bar";
BlazeMessage msg = new BlazeMessage("test payload");
sender.broadcast(destination,msg);
//shutdown the sender
sender.shutDown();

You can similarly subscribe to Topic messages by using a listener

BlazeChannel receiver = factory.createChannel();
receiver.start();

//add a listener

receiver.addBlazeTopicMessageListener(destination, new BlazeMessageListener() {
            public void onMessage(BlazeMessage msg) {
                System.out.println("Got a msg: " + msg);
            }
        });

receiver.shutDown();

Apache、ActiveMQ、Apache ActiveMQ、Apache 羽毛標誌和 Apache ActiveMQ 專案標誌是 The Apache Software Foundation 的商標。版權所有 © 2024,The Apache Software Foundation。根據 Apache License 2.0 授權。