-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: messagingIssues in messaging modules (jms, messaging)Issues in messaging modules (jms, messaging)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
Affects: 5.1.x
On sending message to JMS expiration header is ignored by JmsTemplate. TTL may be set per message - Message.setJMSExpiration(long expiration)
. For now JmsTesmpate support expiration of message per producer - any message level TTL is ignored
/**
* Actually send the given JMS message.
* @param producer the JMS MessageProducer to send with
* @param message the JMS Message to send
* @throws JMSException if thrown by JMS API methods
*/
protected void doSend(MessageProducer producer, Message message) throws JMSException {
if (this.deliveryDelay >= 0) {
producer.setDeliveryDelay(this.deliveryDelay);
}
if (isExplicitQosEnabled()) {
producer.send(message, getDeliveryMode(), getPriority(), getTimeToLive());
}
else {
producer.send(message);
}
}
Suggestion: resolve TTL of message in following way:
- TTL per message - if not set then
- TTL per producer
Current JmsTemplate
implementation checks for 2 ignoring message level.
Example of fix:
/**
* Actually send the given JMS message.
* @param producer the JMS MessageProducer to send with
* @param message the JMS Message to send
* @throws JMSException if thrown by JMS API methods
*/
protected void doSend(MessageProducer producer, Message message) throws JMSException {
if (this.deliveryDelay >= 0) {
producer.setDeliveryDelay(this.deliveryDelay);
}
producer.setTimeToLive(resolveTimeToLive(message));
if (isExplicitQosEnabled()) {
producer.setDeliveryMode(getDeliveryMode());
producer.setPriority(getPriority());
}
producer.send(message);
}
private long resolveTimeToLive(Message message){
long messageTimeToLive = message.getJMSExpiration();
if (messageTimeToLive > 0{
return messageTimeToLive ;
} else {
return getTimeToLive());
}
}
PR could be created and provided.
cynicLT, petronis, kasuparu, NikasZalias and zilvinasj
Metadata
Metadata
Assignees
Labels
in: messagingIssues in messaging modules (jms, messaging)Issues in messaging modules (jms, messaging)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid