io.openmessaging.Message.BuiltinKeys Java Examples
The following examples show how to use
io.openmessaging.Message.BuiltinKeys.
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 rocketmq-4.3.0 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.sysHeaders(); KeyValue properties = omsMsg.userHeaders(); 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.putSysHeaders(BuiltinKeys.MESSAGE_ID, rmqMsg.getMsgId()); omsMsg.putSysHeaders(BuiltinKeys.DESTINATION, rmqMsg.getTopic()); omsMsg.putSysHeaders(BuiltinKeys.SEARCH_KEYS, rmqMsg.getKeys()); omsMsg.putSysHeaders(BuiltinKeys.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putSysHeaders(BuiltinKeys.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putSysHeaders(BuiltinKeys.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putSysHeaders(BuiltinKeys.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #2
Source File: OMSUtil.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public static boolean isOMSHeader(String value) { for (Field field : BuiltinKeys.class.getDeclaredFields()) { try { if (field.get(BuiltinKeys.class).equals(value)) { return true; } } catch (IllegalAccessException e) { return false; } } return false; }
Example #3
Source File: OMSUtil.java From rocketmq-read 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.sysHeaders(); KeyValue properties = omsMsg.userHeaders(); 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.putSysHeaders(BuiltinKeys.MESSAGE_ID, rmqMsg.getMsgId()); omsMsg.putSysHeaders(BuiltinKeys.DESTINATION, rmqMsg.getTopic()); omsMsg.putSysHeaders(BuiltinKeys.SEARCH_KEYS, rmqMsg.getKeys()); omsMsg.putSysHeaders(BuiltinKeys.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putSysHeaders(BuiltinKeys.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putSysHeaders(BuiltinKeys.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putSysHeaders(BuiltinKeys.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #4
Source File: OMSUtil.java From rocketmq-read with Apache License 2.0 | 5 votes |
public static boolean isOMSHeader(String value) { for (Field field : BuiltinKeys.class.getDeclaredFields()) { try { if (field.get(BuiltinKeys.class).equals(value)) { return true; } } catch (IllegalAccessException e) { return false; } } return false; }
Example #5
Source File: OMSUtil.java From rocketmq 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.sysHeaders(); KeyValue properties = omsMsg.userHeaders(); 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.putSysHeaders(BuiltinKeys.MESSAGE_ID, rmqMsg.getMsgId()); omsMsg.putSysHeaders(BuiltinKeys.DESTINATION, rmqMsg.getTopic()); omsMsg.putSysHeaders(BuiltinKeys.SEARCH_KEYS, rmqMsg.getKeys()); omsMsg.putSysHeaders(BuiltinKeys.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putSysHeaders(BuiltinKeys.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putSysHeaders(BuiltinKeys.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putSysHeaders(BuiltinKeys.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #6
Source File: OMSUtil.java From rocketmq with Apache License 2.0 | 5 votes |
public static boolean isOMSHeader(String value) { for (Field field : BuiltinKeys.class.getDeclaredFields()) { try { if (field.get(BuiltinKeys.class).equals(value)) { return true; } } catch (IllegalAccessException e) { return false; } } return false; }