Exemple #1
0
 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));
   }
 }
Exemple #2
0
  public static void setJMSReplyTo(Message message, final SimpleString dest) {

    if (dest == null) {
      message.removeProperty(REPLYTO_HEADER_NAME);
    } else {

      message.putStringProperty(REPLYTO_HEADER_NAME, dest);
    }
  }
Exemple #3
0
  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);
    }
  }
Exemple #4
0
 public static String getJMSCorrelationID(Message message) {
   try {
     return message.getStringProperty(CORRELATIONID_HEADER_NAME);
   } catch (ActiveMQPropertyConversionException e) {
     return null;
   }
 }
Exemple #5
0
 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);
 }
Exemple #6
0
  public static String getJMSType(Message message) {
    SimpleString ss = message.getSimpleStringProperty(TYPE_HEADER_NAME);

    if (ss != null) {
      return ss.toString();
    } else {
      return null;
    }
  }
Exemple #7
0
  public static byte[] getJMSCorrelationIDAsBytes(Message message) {
    Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);

    if (obj instanceof byte[]) {
      return (byte[]) obj;
    } else {
      return null;
    }
  }
Exemple #8
0
  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;
  }
Exemple #9
0
 public static void setJMSType(Message message, String type) {
   message.putStringProperty(TYPE_HEADER_NAME, new SimpleString(type));
 }
Exemple #10
0
 public static ActiveMQBuffer getBodyBuffer(Message message) {
   return message.getBodyBuffer();
 }
Exemple #11
0
 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);
 }
Exemple #12
0
 public static SimpleString getJMSReplyTo(Message message) {
   return message.getSimpleStringProperty(REPLYTO_HEADER_NAME);
 }