public String getStringProperty(final String name) throws JMSException { if (JMSXDELIVERYCOUNT.equals(name)) { return String.valueOf(message.getDeliveryCount()); } Object value; if (JMSXGROUPID.equals(name)) { value = message.getProperty(MessageImpl.GROUP_ID); } else { value = message.getProperty(new SimpleString(name)); } if (value == null) return null; if (value instanceof SimpleString) { return ((SimpleString) value).toString(); } else if (value instanceof Boolean) { return value.toString(); } else if (value instanceof Byte) { return value.toString(); } else if (value instanceof Short) { return value.toString(); } else if (value instanceof Integer) { return value.toString(); } else if (value instanceof Long) { return value.toString(); } else if (value instanceof Float) { return value.toString(); } else if (value instanceof Double) { return value.toString(); } else { throw new MessageFormatException("Invalid conversion"); } }
public long getLongProperty(final String name) throws JMSException { if (JMSXDELIVERYCOUNT.equals(name)) { return message.getDeliveryCount(); } Object value = message.getProperty(new SimpleString(name)); if (value == null) { throw new NumberFormatException("Message property '" + name + "' not set."); } if (value instanceof Byte) { return ((Byte) value).longValue(); } else if (value instanceof Short) { return ((Short) value).longValue(); } else if (value instanceof Integer) { return ((Integer) value).longValue(); } else if (value instanceof Long) { return ((Long) value).longValue(); } else if (value instanceof SimpleString) { return Long.parseLong(((SimpleString) value).toString()); } else { throw new MessageFormatException("Invalid conversion"); } }
public Object getObjectProperty(final String name) throws JMSException { if (JMSXDELIVERYCOUNT.equals(name)) { return String.valueOf(message.getDeliveryCount()); } Object val = message.getProperty(new SimpleString(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); } return val; }
public void setJMSRedelivered(final boolean redelivered) throws JMSException { if (!redelivered) { message.setDeliveryCount(1); } else { if (message.getDeliveryCount() > 1) { // do nothing } else { message.setDeliveryCount(2); } } }
public boolean getJMSRedelivered() throws JMSException { return message.getDeliveryCount() > 1; }