public static void setJMSCorrelationID(Message message, final String correlationID) { if (correlationID == null) { message.removeProperty(CORRELATIONID_HEADER_NAME); } else { message.putStringProperty(CORRELATIONID_HEADER_NAME, new SimpleString(correlationID)); } }
public static void setJMSReplyTo(Message message, final SimpleString dest) { if (dest == null) { message.removeProperty(REPLYTO_HEADER_NAME); } else { message.putStringProperty(REPLYTO_HEADER_NAME, dest); } }
public static void clearProperties(Message message) { List<SimpleString> toRemove = new ArrayList<SimpleString>(); for (SimpleString propName : message.getPropertyNames()) { if (!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) { toRemove.add(propName); } } for (SimpleString propName : toRemove) { message.removeProperty(propName); } }
public static String getJMSCorrelationID(Message message) { try { return message.getStringProperty(CORRELATIONID_HEADER_NAME); } catch (ActiveMQPropertyConversionException e) { return null; } }
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
public static String getJMSType(Message message) { SimpleString ss = message.getSimpleStringProperty(TYPE_HEADER_NAME); if (ss != null) { return ss.toString(); } else { return null; } }
public static byte[] getJMSCorrelationIDAsBytes(Message message) { Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME); if (obj instanceof byte[]) { return (byte[]) obj; } else { return null; } }
public static Set<String> getPropertyNames(Message message) { HashSet<String> set = new HashSet<String>(); for (SimpleString propName : message.getPropertyNames()) { if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME)) { set.add(propName.toString()); } } set.add(JMSXDELIVERYCOUNT); return set; }
public static void setJMSType(Message message, String type) { message.putStringProperty(TYPE_HEADER_NAME, new SimpleString(type)); }
public static ActiveMQBuffer getBodyBuffer(Message message) { return message.getBodyBuffer(); }
public static boolean propertyExists(Message message, String name) { return message.containsProperty(new SimpleString(name)) || name.equals(MessageUtil.JMSXDELIVERYCOUNT) || MessageUtil.JMSXGROUPID.equals(name) && message.containsProperty(org.apache.activemq.api.core.Message.HDR_GROUP_ID); }
public static SimpleString getJMSReplyTo(Message message) { return message.getSimpleStringProperty(REPLYTO_HEADER_NAME); }