org.apache.rocketmq.common.message.Message.setProperties()方法的使用及代码示例

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

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

Message.setProperties介绍

暂无

代码示例

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

public static void setProperties(final Message msg, Map<String, String> properties) {
  msg.setProperties(properties);
}

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

public static Message decodeMessage(ByteBuffer byteBuffer) throws Exception {
  Message message = new Message();
  // 1 TOTALSIZE
  byteBuffer.getInt();
  // 2 MAGICCODE
  byteBuffer.getInt();
  // 3 BODYCRC
  byteBuffer.getInt();
  // 4 FLAG
  int flag = byteBuffer.getInt();
  message.setFlag(flag);
  // 5 BODY
  int bodyLen = byteBuffer.getInt();
  byte[] body = new byte[bodyLen];
  byteBuffer.get(body);
  message.setBody(body);
  // 6 properties
  short propertiesLen = byteBuffer.getShort();
  byte[] propertiesBytes = new byte[propertiesLen];
  byteBuffer.get(propertiesBytes);
  message.setProperties(string2messageProperties(new String(propertiesBytes, CHARSET_UTF8)));
  return message;
}

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

public static Message cloneMessage(final Message msg) {
  Message newMsg = new Message(msg.getTopic(), msg.getBody());
  newMsg.setFlag(msg.getFlag());
  newMsg.setProperties(msg.getProperties());
  return newMsg;
}

代码示例来源:origin: didi/DDMQ

public static void setProperties(final Message msg, Map<String, String> properties) {
  msg.setProperties(properties);
}

代码示例来源:origin: didi/DDMQ

public static Message decodeMessage(ByteBuffer byteBuffer) throws Exception {
  Message message = new Message();
  // 1 TOTALSIZE
  byteBuffer.getInt();
  // 2 MAGICCODE
  byteBuffer.getInt();
  // 3 BODYCRC
  byteBuffer.getInt();
  // 4 FLAG
  int flag = byteBuffer.getInt();
  message.setFlag(flag);
  // 5 BODY
  int bodyLen = byteBuffer.getInt();
  byte[] body = new byte[bodyLen];
  byteBuffer.get(body);
  message.setBody(body);
  // 6 properties
  short propertiesLen = byteBuffer.getShort();
  byte[] propertiesBytes = new byte[propertiesLen];
  byteBuffer.get(propertiesBytes);
  message.setProperties(string2messageProperties(new String(propertiesBytes, CHARSET_UTF8)));
  return message;
}

代码示例来源:origin: org.apache.rocketmq/rocketmq-common

public static void setProperties(final Message msg, Map<String, String> properties) {
  msg.setProperties(properties);
}

代码示例来源:origin: org.apache.rocketmq/rocketmq-common

public static Message decodeMessage(ByteBuffer byteBuffer) throws Exception {
  Message message = new Message();
  // 1 TOTALSIZE
  byteBuffer.getInt();
  // 2 MAGICCODE
  byteBuffer.getInt();
  // 3 BODYCRC
  byteBuffer.getInt();
  // 4 FLAG
  int flag = byteBuffer.getInt();
  message.setFlag(flag);
  // 5 BODY
  int bodyLen = byteBuffer.getInt();
  byte[] body = new byte[bodyLen];
  byteBuffer.get(body);
  message.setBody(body);
  // 6 properties
  short propertiesLen = byteBuffer.getShort();
  byte[] propertiesBytes = new byte[propertiesLen];
  byteBuffer.get(propertiesBytes);
  message.setProperties(string2messageProperties(new String(propertiesBytes, CHARSET_UTF8)));
  return message;
}

代码示例来源:origin: org.apache.rocketmq/rocketmq-common

public static Message cloneMessage(final Message msg) {
  Message newMsg = new Message(msg.getTopic(), msg.getBody());
  newMsg.setFlag(msg.getFlag());
  newMsg.setProperties(msg.getProperties());
  return newMsg;
}

相关文章