diff --git a/pulsar-jms/src/main/java/com/datastax/oss/pulsar/jms/PulsarJMSProducer.java b/pulsar-jms/src/main/java/com/datastax/oss/pulsar/jms/PulsarJMSProducer.java index 3f749f15..702f11eb 100644 --- a/pulsar-jms/src/main/java/com/datastax/oss/pulsar/jms/PulsarJMSProducer.java +++ b/pulsar-jms/src/main/java/com/datastax/oss/pulsar/jms/PulsarJMSProducer.java @@ -191,10 +191,18 @@ private void getProducerAndSend(Destination destination, Message message) throws for (Map.Entry prop : properties.entrySet()) { message.setObjectProperty(prop.getKey(), prop.getValue()); } - message.setJMSPriority(priority); - message.setJMSCorrelationIDAsBytes(correlationID); - message.setJMSType(jmsType); - message.setJMSReplyTo(jmsReplyTo); + if (message.getJMSPriority() != Message.DEFAULT_PRIORITY) { + message.setJMSPriority(priority); + } + if (message.getJMSCorrelationIDAsBytes() != null) { + message.setJMSCorrelationIDAsBytes(message.getJMSCorrelationIDAsBytes()); + } + if (message.getJMSType() != null) { + message.setJMSType(message.getJMSType()); + } + if (message.getJMSReplyTo() != null) { + message.setJMSReplyTo(message.getJMSReplyTo()); + } if (completionListener != null) { producer.send(destination, message, deliveryMode, priority, timeToLive, completionListener);