com.alibaba.rocketmq.common.message.Message.setKeys()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(446)

本文整理了Java中com.alibaba.rocketmq.common.message.Message.setKeys()方法的一些代码示例,展示了Message.setKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setKeys()方法的具体详情如下:
包路径:com.alibaba.rocketmq.common.message.Message
类名称:Message
方法名:setKeys

Message.setKeys介绍

暂无

代码示例

代码示例来源:origin: com.alibaba.rocketmq/rocketmq-common

public void setKeys(Collection<String> keys) {
  StringBuffer sb = new StringBuffer();
  for (String k : keys) {
    sb.append(k);
    sb.append(MessageConst.KEY_SEPARATOR);
  }
  this.setKeys(sb.toString().trim());
}

代码示例来源:origin: com.alibaba.rocketmq/rocketmq-client

public void setKeys(Collection<String> keys) {
  StringBuffer sb = new StringBuffer();
  for (String k : keys) {
    sb.append(k);
    sb.append(MessageConst.KEY_SEPARATOR);
  }
  this.setKeys(sb.toString().trim());
}

代码示例来源:origin: kuangye098/rocketmq

public void setKeys(Collection<String> keys) {
  StringBuffer sb = new StringBuffer();
  for (String k : keys) {
    sb.append(k);
    sb.append(MessageConst.KEY_SEPARATOR);
  }
  this.setKeys(sb.toString().trim());
}

代码示例来源:origin: com.alibaba.rocketmq/rocketmq-client

public Message(String topic, String tags, String keys, int flag, byte[] body, boolean waitStoreMsgOK) {
  this.topic = topic;
  this.flag = flag;
  this.body = body;
  if (tags != null && tags.length() > 0)
    this.setTags(tags);
  if (keys != null && keys.length() > 0)
    this.setKeys(keys);
  this.setWaitStoreMsgOK(waitStoreMsgOK);
}

代码示例来源:origin: com.alibaba.rocketmq/rocketmq-common

public Message(String topic, String tags, String keys, int flag, byte[] body, boolean waitStoreMsgOK) {
  this.topic = topic;
  this.flag = flag;
  this.body = body;
  if (tags != null && tags.length() > 0)
    this.setTags(tags);
  if (keys != null && keys.length() > 0)
    this.setKeys(keys);
  this.setWaitStoreMsgOK(waitStoreMsgOK);
}

代码示例来源:origin: kuangye098/rocketmq

public Message(String topic, String tags, String keys, int flag, byte[] body, boolean waitStoreMsgOK) {
  this.topic = topic;
  this.flag = flag;
  this.body = body;
  if (tags != null && tags.length() > 0)
    this.setTags(tags);
  if (keys != null && keys.length() > 0)
    this.setKeys(keys);
  this.setWaitStoreMsgOK(waitStoreMsgOK);
}

代码示例来源:origin: coffeewar/enode-master

/**
   * 发送数据的接口
   *
   * @param keySet 本批次包含的keyset
   * @param data 本批次的轨迹数据
   */
  private void sendTraceDataByMQ(Set<String> keySet, final String data, String currentRegionId) {
    String topic = OnsTraceConstants.traceTopic + currentRegionId;
    final Message message = new Message(topic, data.getBytes());
    message.setKeys(keySet);
    try {
      traceProducer.send(message, new SendCallback() {
        @Override
        public void onSuccess(SendResult sendResult) {
        }
        @Override
        public void onException(Throwable e) {
          //todo 对于发送失败的数据,如何保存,保证所有轨迹数据都记录下来
          clientlog.info("send trace data ,the traceData is " + data);
        }
      }, 5000);
    } catch (Exception e) {
      clientlog.info("send trace data,the traceData is" + data);
    }
  }
}

代码示例来源:origin: coffeewar/enode-master

/**
 * 发送数据的接口
 *
 * @param keySet 本批次包含的keyset
 * @param data   本批次的轨迹数据
 */
public void sendTraceDataByMQ(Set<String> keySet, String data) {
  String topic = OnsTraceConstants.traceTopic + currentRegionId;
  final Message message = new Message(topic, data.getBytes());
  message.setKeys(keySet);
  try {
    traceProducer.send(message, new SendCallback() {
      @Override
      public void onSuccess(SendResult sendResult) {
      }
      @Override
      public void onException(Throwable e) {
        //todo 对于发送失败的数据,如何保存,保证所有轨迹数据都记录下来
        clientlog.info("send trace data failed ,the msgidSet is" + message.getKeys());
      }
    }, 5000);
  } catch (Exception e) {
    clientlog.info("send trace data failed ,the msgidSet is" + message.getKeys());
  }
}

代码示例来源:origin: kuangye098/rocketmq

final long beginTimestamp = System.currentTimeMillis();
if (keyEnable) {
  msg.setKeys(String.valueOf(beginTimestamp / 1000));

代码示例来源:origin: com.aliyun.openservices/ons-trace-core

String topic = OnsTraceConstants.traceTopic + currentRegionId;
final Message message = new Message(topic, data.getBytes());
message.setKeys(keySet);
try {
  Set<String> dataBrokerSet = getBrokerSetByTopic(dataTopic);

代码示例来源:origin: beston123/Tarzan

message.setTopic(Constants.TARZAN_TEST_TOPIC);
message.setTags(TestConstants.MESSAGE_TAG);
message.setKeys(messageKey);
message.setBody(messageKey.getBytes());

相关文章