Bug 31453 - Add ability to filter messages to process using process_message_queue.pl via a command line parameter
Summary: Add ability to filter messages to process using process_message_queue.pl via ...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Kyle M Hall (khall)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-24 17:54 UTC by Kyle M Hall (khall)
Modified: 2023-12-28 20:47 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00
Circulation function:


Attachments
Bug 31453: Add ability to skip processing messages in message queue based on message contents (6.32 KB, patch)
2022-08-24 18:35 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 31453: Add ability to skip processing messages in message queue based on message contents (6.86 KB, patch)
2022-08-26 13:27 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter (6.79 KB, patch)
2022-11-01 17:16 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter (6.85 KB, patch)
2023-01-27 15:24 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter (6.91 KB, patch)
2023-02-28 06:04 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2022-08-24 17:54:35 UTC
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.
Comment 1 Kyle M Hall (khall) 2022-08-24 18:35:53 UTC
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
Comment 2 Kyle M Hall (khall) 2022-08-26 13:27:55 UTC
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
Comment 3 Kyle M Hall (khall) 2022-11-01 17:16:09 UTC
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
Comment 4 Andrew Fuerste-Henry 2023-01-27 15:24:20 UTC
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>
Comment 5 Victor Grousset/tuxayo 2023-02-28 06:04:21 UTC
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>
Comment 6 Victor Grousset/tuxayo 2023-02-28 06:06:35 UTC
Works, QA script happy, code looks good, passing QA :)
Comment 7 Tomás Cohen Arazi (tcohen) 2023-03-02 12:39:24 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 8 Marcel de Rooy 2023-04-07 09:41:33 UTC
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?
Comment 9 Marcel de Rooy 2023-04-07 09:46:24 UTC
<Joubu> marcelr: 33360 - see misc/cronjobs/membership_expiry.pl:199 $upcoming_mem_expires = $upcoming_mem_expires->search( \$where_literal ) if @where;