jan salawa
jan salawa

Reputation: 1208

How does ActiveMQ AMQ_SCHEDULED_DELAY message works?

We want to use delay feature from activeMQ to delay particural event. How does AMQ_SCHEDULED_DELAY work internaly? In documentation is information about scheduler but no information what mechanism it utilize to delay message. For that reason we are not sure how delaying is going to affect activeMQ. Does activeMQ utilize pooling or async to achive delay.

I ask this question because people from my organization want to pick diffrent technology. I do not have any proof delay from activeMQ is any better.

Here is link to source code. I was thinking of looking up code but I'm not good in java. Can anyone help?

Upvotes: 1

Views: 3219

Answers (3)

Steve Harrington
Steve Harrington

Reputation: 942

In looking at the source code mentioned by @skadya, the term "polling" is not what I interpret. It appears to use the Java Object class' wait(long timeout) method to determine when to "wake up" the thread that runs the jobs.

So, I wouldn't call it polling. I would call it an asynchronous mechanism in which the delay / timeout is set such that the thread will wake up (e.g. to run the next scheduled job at the appropriate time) via the timeout set to a value that is appropriate for the next scheduled job's commencement.

Javadoc for Object.wait(long timeout)

Note that the implementation for Object.wait is a native (i.e. non-java) implementation provided by the JDK / JRE / JVM for a given platform. For what that's worth.

Upvotes: 3

skadya
skadya

Reputation: 4390

Default implementation of ActiveMQ does utilize the polling.

Active MQ internally keep polling for the scheduled (or delayed) messages by a background scheduler thread. This thread read the list of scheduled events (or messages) and fires the jobs, reschedule repeating jobs as needed before firing the job event.

The list of scheduled events is stored in a sorted order in internal storage of activemq. So during poll, it just read event which are scheduled for earliest processing. Since the messages are persisted during enquing, scheduling many not have visible performance impact during processing.

However before adopting, you can setup your benchmark, without worries much internal implementation detail, to see that your performance/SLA requirement are getting met.

For more details, you may refer to Javadoc of job scheduler API. For default implementation can you refers to the code.

Hope this helps.

Upvotes: 3

jan salawa
jan salawa

Reputation: 1208

It is possible to do performance test with activemq web console. There is an option to send message with configurable delay and number of messages to send. It doesn't answer my question but it seems like best option to compare two approaches.

Upvotes: 2

Related Questions