How to flush notifications queue?


If my understanding is correct, with Elgg 1.9.x notifications to work, one needs to define a minute cron job. I think this is something new.

Who populates the notifications queue? Cron job?

Is there a way to delete all the existing entries in the notifications queue?

Best Regards.

  • Well, technically the cron job doesn't need to be called once a minute. You can call it e.g. once an hour if you like. The only requirement is that when doing it, the address being called needs to be

    Have you already read this documentation: ?

    You could delete the entries from the notifications queue. But there is no API for this so you'd need to delete them manually straight from the database. And messing with the database directly is never a good idea unless you have a really good reason for it.

  • Thanks Juho for the reply. My shared host does not allow any cron job shorter than 15 min anyway. I would set it at 15m.  I had read the cron page in the documentation but it is more on cron jobs than notifications (it is mentioned though).

    I wanted to flush the notifications queue before setting any cron job not to flood the users with the stuff accumulated in the queue over the time. (this is of course is irrelevant if the queue is populated by the cron job itself. On the other hand, it is relevant, if cron job uses the queue only for consuming and for sending the messages. It is not clear to me which is the case...) 

    It would be handy to have a config setting somewhere to flush the queue and I was hoping I just could not find it. Deleting it from the DB tables is not really for me, due to Elgg's data model keeping different entities in the same tables by using types or so. I would most likely break the data integrity.

  • Cron is used just for sending the notifications.

    Each time the cron job gets triggered, it sends only as many notifications as it is able to do within 45 seconds:

    So it won't necessarily send all the notifications at once, but most likely process only a few of them and then continue on the next time it gets triggered.

  • Hi, I see this is quite an old thread but I am running a site with Elgg 2.2 the cron job was not working for a long time so there are a lot of backed up notifications. Is it possible to flush the notification queue, if it is, how? I don't want the users to suddenly get hundreds of emails.

  • You can just empty the queue DB table, I think it's only sane way to do it. You could also unregister email notification handler and let the cron complete.

  • For some reason my Event calendar just will not send reminder notifications. I thought it was a Cron problem but after annoying several folks on the ELGG forum and at my webhosting provider it appears that all cron jobs, including the minute and five minute are working fine. 

    When I look under Statistics in the Dashboard I see that there are 10 unsent messages at anytime. It seems that is about the number of calendar reminders that should have been sent. Is there a way to see if those are indeed the calendar reminders that should be going out as knowing might provide a clue as to what the problem might possibly be.


  • Some actions are saved in the logs. Try to use Log browser (bundled) plugin.

    You also use a Message queue plugin. All unsent messages are objects with subtypes' name 'message_queue_message' and status 'unsent'.

    Knowing their GUIDs (via Log browser) you can delete their metadata: 'name' => 'status', 'value' => 'unsent' using Entity Explorer tool by Elgg Developer Tools plugin.