I'm trying to avoid sending a message in the application level. Because the message is special; It is just an empty message that I send to ActiveMQ which is later delivered after x minutes to clients (a way for maintaining a shared clock).
This is Schedule Message Delivery and is part of ActiveMQ features.
OK, back to the question, as could send the message scheduled for delivery to clients each x minutes:
sendNotifications(
{ data: {} },
{
schedule: {
cron: `*/5 * * * *`,
},
}
);
I try to avoid sending this message on app bootstrap but on configuration of ActiveMQ itself!
There is no way to initialize a queue with a message configured via activemq.xml
(or any other supported broker configuration file). You'll need to use an application to send this message.