Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ public void execute() throws Exception {
}
});
}
if (m.propertyExists(ActiveMQMessage.JMS_DELIVERY_TIME_PROPERTY)) {
m.setJMSDeliveryTime(m.getLongProperty(ActiveMQMessage.JMS_DELIVERY_TIME_PROPERTY));
}
return m;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import jakarta.jms.ObjectMessage;
import jakarta.jms.TextMessage;

import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.util.JMSExceptionSupport;
import org.apache.activemq.util.TypeConversionSupport;

Expand All @@ -46,6 +47,7 @@ public class ActiveMQProducer implements JMSProducer {
// QoS override of defaults on a per-JMSProducer instance basis
private String correlationId = null;
private byte[] correlationIdBytes = null;
private Long deliveryDelay = null;
private Integer deliveryMode = null;
private Boolean disableMessageID = false;
private Boolean disableMessageTimestamp = false;
Expand Down Expand Up @@ -87,6 +89,13 @@ public JMSProducer send(Destination destination, Message message) {
}
}

// [AMQ-8320] Producer setting for deliveryDelay will override user-specified ActiveMQ Scheduled Delay property
if(this.deliveryDelay != null) {
long deliveryTimeMillis = System.currentTimeMillis() + this.deliveryDelay;
message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, this.deliveryDelay);
message.setLongProperty(ActiveMQMessage.JMS_DELIVERY_TIME_PROPERTY, deliveryTimeMillis);
}

activemqMessageProducer.send(destination, message, getDeliveryMode(), getPriority(), getTimeToLive(), getDisableMessageID(), getDisableMessageTimestamp(), null);
} catch (JMSException e) {
throw JMSExceptionSupport.convertToJMSRuntimeException(e);
Expand Down Expand Up @@ -243,12 +252,13 @@ public long getTimeToLive() {

@Override
public JMSProducer setDeliveryDelay(long deliveryDelay) {
throw new UnsupportedOperationException("setDeliveryDelay(long) is not supported");
this.deliveryDelay = deliveryDelay;
return this;
}

@Override
public long getDeliveryDelay() {
throw new UnsupportedOperationException("getDeliveryDelay() is not supported");
return this.deliveryDelay;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess
public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_MESSAGE;
public static final String DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = "dlqDeliveryFailureCause";
public static final String BROKER_PATH_PROPERTY = "JMSActiveMQBrokerPath";
public static final String JMS_DELIVERY_TIME_PROPERTY = "JMSDeliveryTime";

private static final Map<String, PropertySetter> JMS_PROPERTY_SETERS = new HashMap<String, PropertySetter>();

Expand Down
Loading