ActiveBlaze 訊息類型

功能 > ActiveMQ Classic 即時 > ActiveBlaze 訊息類型

在 ActiveBlaze 中,訊息和事件解析的基礎是 BlazeMessage。
BlazeMessage 是一個鍵值對的 Map,其中鍵是字串,值是原始物件。

支援的值如下:

  • byte
  • bytes[]
  • char
  • short
  • int
  • long
  • float
  • double
  • Map (支援遞迴)

您可以使用預設建構子建立 BlazeMessage,例如:

import org.apache.activeblaze.*;
...

BlazeMessage msg = new BlazeMessage();
msg.setFloatValue("rate",0.94f);

有一些實用方法支援傳遞標準物件,例如:

import org.apache.activeblaze.*;
...

BlazeMessage msg = new BlazeMessage("test string");
String text = msg.getText();

BlazeMessage msg = new BlazeMessage();
msg.setText("test string");
String text = msg.getText();

...

byte[] data = getSomeData();
BlazeMessage msg = new BlazeMessage(data);
byte[] result  = msg.getBytes();

BlazeMessage msg = new BlazeMessage();
msg.setBytes("data);
byte[] result = msg.getData();

...

Date date = new Date();
BlazeMessage msg = new BlazeMessage(date);
Date result = msg.getObject();

BlazeMessage msg = new BlazeMessage();
msg.setObject(date);
Object result = msg.getObject();

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