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

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

本文整理了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

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

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

  1. public static Message decodeMessage(ByteBuffer byteBuffer) throws Exception {
  2. Message message = new Message();
  3. // 1 TOTALSIZE
  4. byteBuffer.getInt();
  5. // 2 MAGICCODE
  6. byteBuffer.getInt();
  7. // 3 BODYCRC
  8. byteBuffer.getInt();
  9. // 4 FLAG
  10. int flag = byteBuffer.getInt();
  11. message.setFlag(flag);
  12. // 5 BODY
  13. int bodyLen = byteBuffer.getInt();
  14. byte[] body = new byte[bodyLen];
  15. byteBuffer.get(body);
  16. message.setBody(body);
  17. // 6 properties
  18. short propertiesLen = byteBuffer.getShort();
  19. byte[] propertiesBytes = new byte[propertiesLen];
  20. byteBuffer.get(propertiesBytes);
  21. message.setProperties(string2messageProperties(new String(propertiesBytes, CHARSET_UTF8)));
  22. return message;
  23. }

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

  1. public static Message cloneMessage(final Message msg) {
  2. Message newMsg = new Message(msg.getTopic(), msg.getBody());
  3. newMsg.setFlag(msg.getFlag());
  4. newMsg.setProperties(msg.getProperties());
  5. return newMsg;
  6. }

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

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

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

  1. public static Message decodeMessage(ByteBuffer byteBuffer) throws Exception {
  2. Message message = new Message();
  3. // 1 TOTALSIZE
  4. byteBuffer.getInt();
  5. // 2 MAGICCODE
  6. byteBuffer.getInt();
  7. // 3 BODYCRC
  8. byteBuffer.getInt();
  9. // 4 FLAG
  10. int flag = byteBuffer.getInt();
  11. message.setFlag(flag);
  12. // 5 BODY
  13. int bodyLen = byteBuffer.getInt();
  14. byte[] body = new byte[bodyLen];
  15. byteBuffer.get(body);
  16. message.setBody(body);
  17. // 6 properties
  18. short propertiesLen = byteBuffer.getShort();
  19. byte[] propertiesBytes = new byte[propertiesLen];
  20. byteBuffer.get(propertiesBytes);
  21. message.setProperties(string2messageProperties(new String(propertiesBytes, CHARSET_UTF8)));
  22. return message;
  23. }

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

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

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

  1. public static Message decodeMessage(ByteBuffer byteBuffer) throws Exception {
  2. Message message = new Message();
  3. // 1 TOTALSIZE
  4. byteBuffer.getInt();
  5. // 2 MAGICCODE
  6. byteBuffer.getInt();
  7. // 3 BODYCRC
  8. byteBuffer.getInt();
  9. // 4 FLAG
  10. int flag = byteBuffer.getInt();
  11. message.setFlag(flag);
  12. // 5 BODY
  13. int bodyLen = byteBuffer.getInt();
  14. byte[] body = new byte[bodyLen];
  15. byteBuffer.get(body);
  16. message.setBody(body);
  17. // 6 properties
  18. short propertiesLen = byteBuffer.getShort();
  19. byte[] propertiesBytes = new byte[propertiesLen];
  20. byteBuffer.get(propertiesBytes);
  21. message.setProperties(string2messageProperties(new String(propertiesBytes, CHARSET_UTF8)));
  22. return message;
  23. }

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

  1. public static Message cloneMessage(final Message msg) {
  2. Message newMsg = new Message(msg.getTopic(), msg.getBody());
  3. newMsg.setFlag(msg.getFlag());
  4. newMsg.setProperties(msg.getProperties());
  5. return newMsg;
  6. }

相关文章