Exemplo n.º 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));
   }
 }
Exemplo n.º 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);
    }
  }
Exemplo n.º 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);
    }
  }
Exemplo n.º 4
0
 public static String getJMSCorrelationID(Message message) {
   try {
     return message.getStringProperty(CORRELATIONID_HEADER_NAME);
   } catch (ActiveMQPropertyConversionException e) {
     return null;
   }
 }
Exemplo n.º 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);
 }
Exemplo n.º 6
0
  public static String getJMSType(Message message) {
    SimpleString ss = message.getSimpleStringProperty(TYPE_HEADER_NAME);

    if (ss != null) {
      return ss.toString();
    } else {
      return null;
    }
  }
Exemplo n.º 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;
    }
  }
Exemplo n.º 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;
  }
Exemplo n.º 9
0
 public static void setJMSType(Message message, String type) {
   message.putStringProperty(TYPE_HEADER_NAME, new SimpleString(type));
 }
Exemplo n.º 10
0
 public static ActiveMQBuffer getBodyBuffer(Message message) {
   return message.getBodyBuffer();
 }
Exemplo n.º 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);
 }
Exemplo n.º 12
0
 public static SimpleString getJMSReplyTo(Message message) {
   return message.getSimpleStringProperty(REPLYTO_HEADER_NAME);
 }