Added support for JMSDeliveryMode header being set generically

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@687332 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2008-08-20 13:44:02 +00:00
parent 67d64862f8
commit fc58b6f6a5
1 changed files with 15 additions and 0 deletions

View File

@ -325,6 +325,21 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess
((ActiveMQMessage) message).setJMSCorrelationID(rc);
}
});
JMS_PROPERTY_SETERS.put("JMSDeliveryMode", new PropertySetter() {
public void set(Message message, Object value) throws MessageFormatException {
Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
if (rc == null) {
Boolean bool = (Boolean) TypeConversionSupport.convert(value, Boolean.class);
if (bool == null) {
throw new MessageFormatException("Property JMSDeliveryMode cannot be set from a " + value.getClass().getName() + ".");
}
else {
rc = bool.booleanValue() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
}
}
((ActiveMQMessage) message).setJMSDeliveryMode(rc);
}
});
JMS_PROPERTY_SETERS.put("JMSExpiration", new PropertySetter() {
public void set(Message message, Object value) throws MessageFormatException {
Long rc = (Long) TypeConversionSupport.convert(value, Long.class);