From 3397a972139214720faa93d8e900ac4b9ac851b7 Mon Sep 17 00:00:00 2001 From: Jeff Genender Date: Wed, 27 Jun 2018 10:29:40 -0600 Subject: [PATCH] AMQ-7002 - Change jobid identifier to messageid format --- .../apache/activemq/broker/scheduler/SchedulerBroker.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/SchedulerBroker.java b/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/SchedulerBroker.java index f14d6c52dc..d8574160a5 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/SchedulerBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/scheduler/SchedulerBroker.java @@ -55,6 +55,7 @@ import org.slf4j.LoggerFactory; public class SchedulerBroker extends BrokerFilter implements JobListener { private static final Logger LOG = LoggerFactory.getLogger(SchedulerBroker.class); private static final IdGenerator ID_GENERATOR = new IdGenerator(); + private static final LongSequenceGenerator longGenerator = new LongSequenceGenerator(); private final LongSequenceGenerator messageIdGenerator = new LongSequenceGenerator(); private final AtomicBoolean started = new AtomicBoolean(); private final WireFormat wireFormat = new OpenWireFormat(); @@ -337,8 +338,10 @@ public class SchedulerBroker extends BrokerFilter implements JobListener { repeat = (Integer) TypeConversionSupport.convert(repeatValue, Integer.class); } - String jobId = ID_GENERATOR.generateId(); - getInternalScheduler().schedule(jobId, + //job id should be unique for every job (Same format as MessageId) + MessageId jobId = new MessageId(messageSend.getMessageId().getProducerId(), longGenerator.getNextSequenceId()); + + getInternalScheduler().schedule(jobId.toString(), new ByteSequence(packet.data, packet.offset, packet.length), cronEntry, delay, period, repeat); }