mirror of https://github.com/apache/activemq.git
AMQ-6808 preserve destination for browsed scheduled messages
(cherry picked from commit c691124d32
)
This commit is contained in:
parent
d894d570d4
commit
e1699d58c8
|
@ -426,6 +426,10 @@ public class SchedulerBroker extends BrokerFilter implements JobListener {
|
||||||
msg.setPersistent(false);
|
msg.setPersistent(false);
|
||||||
msg.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
|
msg.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
|
||||||
msg.setMessageId(new MessageId(this.producerId, this.messageIdGenerator.getNextSequenceId()));
|
msg.setMessageId(new MessageId(this.producerId, this.messageIdGenerator.getNextSequenceId()));
|
||||||
|
|
||||||
|
// Preserve original destination
|
||||||
|
msg.setOriginalDestination(msg.getDestination());
|
||||||
|
|
||||||
msg.setDestination(replyTo);
|
msg.setDestination(replyTo);
|
||||||
msg.setResponseRequired(false);
|
msg.setResponseRequired(false);
|
||||||
msg.setProducerId(this.producerId);
|
msg.setProducerId(this.producerId);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import javax.jms.Session;
|
||||||
import javax.jms.TextMessage;
|
import javax.jms.TextMessage;
|
||||||
|
|
||||||
import org.apache.activemq.ScheduledMessage;
|
import org.apache.activemq.ScheduledMessage;
|
||||||
|
import org.apache.activemq.command.ActiveMQMessage;
|
||||||
import org.apache.activemq.util.IdGenerator;
|
import org.apache.activemq.util.IdGenerator;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -396,6 +397,9 @@ public class JobSchedulerManagementTest extends JobSchedulerTestSupport {
|
||||||
assertNotNull(message);
|
assertNotNull(message);
|
||||||
assertEquals(45000, message.getLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY));
|
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
|
// Now check if there are anymore, there shouldn't be
|
||||||
message = browser.receive(5000);
|
message = browser.receive(5000);
|
||||||
assertNull(message);
|
assertNull(message);
|
||||||
|
|
Loading…
Reference in New Issue