AMQ-6808 preserve destination for browsed scheduled messages

This commit is contained in:
Erik Wramner 2017-09-12 21:46:02 +02:00 committed by Timothy Bish
parent a359d8152c
commit c691124d32
2 changed files with 8 additions and 0 deletions

View File

@ -426,6 +426,10 @@ public class SchedulerBroker extends BrokerFilter implements JobListener {
msg.setPersistent(false);
msg.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
msg.setMessageId(new MessageId(this.producerId, this.messageIdGenerator.getNextSequenceId()));
// Preserve original destination
msg.setOriginalDestination(msg.getDestination());
msg.setDestination(replyTo);
msg.setResponseRequired(false);
msg.setProducerId(this.producerId);

View File

@ -34,6 +34,7 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ScheduledMessage;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.util.IdGenerator;
import org.junit.Test;
import org.slf4j.Logger;
@ -396,6 +397,9 @@ public class JobSchedulerManagementTest extends JobSchedulerTestSupport {
assertNotNull(message);
assertEquals(45000, message.getLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY));
// Verify that original destination was preserved
assertEquals(destination, ((ActiveMQMessage) message).getOriginalDestination());
// Now check if there are anymore, there shouldn't be
message = browser.receive(5000);
assertNull(message);