Java Code Examples for io.openmessaging.BytesMessage#headers()
The following examples show how to use
io.openmessaging.BytesMessage#headers() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OMSUtil.java From DDMQ with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.headers(); KeyValue properties = omsMsg.properties(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putHeaders(MessageHeader.MESSAGE_ID, rmqMsg.getMsgId()); if (!rmqMsg.getProperties().containsKey(NonStandardKeys.MESSAGE_DESTINATION) || rmqMsg.getProperties().get(NonStandardKeys.MESSAGE_DESTINATION).equals("TOPIC")) { omsMsg.putHeaders(MessageHeader.TOPIC, rmqMsg.getTopic()); } else { omsMsg.putHeaders(MessageHeader.QUEUE, rmqMsg.getTopic()); } omsMsg.putHeaders(MessageHeader.SEARCH_KEY, rmqMsg.getKeys()); omsMsg.putHeaders(MessageHeader.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putHeaders(MessageHeader.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putHeaders(MessageHeader.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putHeaders(MessageHeader.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example 2
Source File: OMSUtil.java From DDMQ with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.headers(); KeyValue properties = omsMsg.properties(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putHeaders(MessageHeader.MESSAGE_ID, rmqMsg.getMsgId()); if (!rmqMsg.getProperties().containsKey(NonStandardKeys.MESSAGE_DESTINATION) || rmqMsg.getProperties().get(NonStandardKeys.MESSAGE_DESTINATION).equals("TOPIC")) { omsMsg.putHeaders(MessageHeader.TOPIC, rmqMsg.getTopic()); } else { omsMsg.putHeaders(MessageHeader.QUEUE, rmqMsg.getTopic()); } omsMsg.putHeaders(MessageHeader.SEARCH_KEY, rmqMsg.getKeys()); omsMsg.putHeaders(MessageHeader.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putHeaders(MessageHeader.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putHeaders(MessageHeader.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putHeaders(MessageHeader.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example 3
Source File: OMSUtil.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.headers(); KeyValue properties = omsMsg.properties(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putHeaders(MessageHeader.MESSAGE_ID, rmqMsg.getMsgId()); if (!rmqMsg.getProperties().containsKey(NonStandardKeys.MESSAGE_DESTINATION) || rmqMsg.getProperties().get(NonStandardKeys.MESSAGE_DESTINATION).equals("TOPIC")) { omsMsg.putHeaders(MessageHeader.TOPIC, rmqMsg.getTopic()); } else { omsMsg.putHeaders(MessageHeader.QUEUE, rmqMsg.getTopic()); } omsMsg.putHeaders(MessageHeader.SEARCH_KEY, rmqMsg.getKeys()); omsMsg.putHeaders(MessageHeader.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putHeaders(MessageHeader.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putHeaders(MessageHeader.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putHeaders(MessageHeader.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }