It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin.
Created attachment 139736 [details] [review] Bug 31453: Add ability to skip processing messages in message queue based on message contents It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin. Test Plan: 1) Apply this patch 2) Queue two messages, each with a unique word 3) Run process_message_queue --content-not-like "WORD" where WORD is a unique word in one of the two message 4) Note the message containing "WORD" was not processed 5) prove t/db_dependent/Letters.t
Created attachment 139828 [details] [review] Bug 31453: Add ability to skip processing messages in message queue based on message contents It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin. Test Plan: 1) Apply this patch 2) Queue two messages, each with a unique word 3) Run process_message_queue --content-not-like "WORD" where WORD is a unique word in one of the two message 4) Note the message containing "WORD" was not processed 5) prove t/db_dependent/Letters.t
Created attachment 142895 [details] [review] Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin. Test Plan: 1) Apply this patch 2) Queue two messages, each with a unique word 3) Run process_message_queue --where "content NOT LIKE '%WORD%'" where WORD is a unique word in one of the two message 4) Note the message containing "WORD" was not processed 5) prove t/db_dependent/Letters.t
Created attachment 145756 [details] [review] Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin. Test Plan: 1) Apply this patch 2) Queue two messages, each with a unique word 3) Run process_message_queue --where "content NOT LIKE '%WORD%'" where WORD is a unique word in one of the two message 4) Note the message containing "WORD" was not processed 5) prove t/db_dependent/Letters.t Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Created attachment 147478 [details] [review] Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin. Test Plan: 1) Apply this patch 2) Queue two messages, each with a unique word 3) Run process_message_queue --where "content NOT LIKE '%WORD%'" where WORD is a unique word in one of the two message 4) Note the message containing "WORD" was not processed 5) prove t/db_dependent/Letters.t Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Works, QA script happy, code looks good, passing QA :)
Pushed to master for 23.05. Nice work everyone, thanks!
I am stumbling over this while doing changes in SendQueuedMessages on bug 33360. I would need to convert the SQL condition into DBIx constructs since I am switching to a Koha object search instead of calling get_unsent_messages. Any clues how to resolve that?
<Joubu> marcelr: 33360 - see misc/cronjobs/membership_expiry.pl:199 $upcoming_mem_expires = $upcoming_mem_expires->search( \$where_literal ) if @where;