Bug 37885

Summary: Add ability to disable message queue processing
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: NoticesAssignee: Kyle M Hall (khall) <kyle>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: baptiste.wojtkowski, hebah, lisette, nick
Version: unspecifiedKeywords: no-sandbox
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 37869    
Bug Blocks:    
Attachments: Bug 37885: Add ability to disable message queue processing
Bug 37885: Add ability to disable message queue processing
Bug 37885: Add ability to disable message queue processing
Bug 37885: Add ability to disable message queue processing

Description Kyle M Hall (khall) 2024-09-10 19:01:45 UTC
There exist services that libraries utilize as an alternative to processing the message queue. These services may utilize the queued messages and send them from outside of Koha. Sometimes these services utilize the API or reports while other times they utilize a plugin. It would be beneficial to be able to disable running the message queue processor altogether, or to only execute the plugin hook related to message queue processing ( before_send_messages ) to limit the processing of messages to those handled by plugins. 

I think a new system preference along the lines of "Process/Don't process/Process only via plugins" would be good, but haven't quite come up with a sentence that makes sense.
Comment 1 Kyle M Hall (khall) 2024-09-19 13:37:09 UTC
Created attachment 171756 [details] [review]
Bug 37885: Add ability to disable message queue processing

There exist services that libraries utilize as an alternative to processing the message queue.
These services may utilize the queued messages and send them from outside of Koha.
Sometimes these services utilize the API or reports while other times they utilize a plugin.
It would be beneficial to be able to disable running the message queue processor altogether,
or to only execute the plugin hook related to message queue processing ( before_send_messages )
to limit the processing of messages to those handled by plugins.

Test Plan:
1)  Apply this patch
2)  Run updatedatabase.pl
3)  Install the kitchen sink plugin, enable it
4)  Enqueue a notice
5)  Set MessageQueueMode to "process nothing"
6)  Run process_message_queue.pl
7)  Note nothing happens, 0 message reported
8)  Set MessageQueueMode to "process plugin hooks only"
9)  Run process_message_queue.pl
10) Note nothing happens, 0 message reported
11) Set MessageQueueMode to "on"
12) Run process_message_queue.pl
13) Note the message fails to send, assuming you have not set
    up anything to actually send messages on your test instance
Comment 2 Kyle M Hall (khall) 2024-09-19 13:41:03 UTC
Created attachment 171757 [details] [review]
Bug 37885: Add ability to disable message queue processing

There exist services that libraries utilize as an alternative to processing the message queue.
These services may utilize the queued messages and send them from outside of Koha.
Sometimes these services utilize the API or reports while other times they utilize a plugin.
It would be beneficial to be able to disable running the message queue processor altogether,
or to only execute the plugin hook related to message queue processing ( before_send_messages )
to limit the processing of messages to those handled by plugins.

Test Plan:
1)  Apply this patch
2)  Run updatedatabase.pl
3)  Install the kitchen sink plugin, enable it
4)  Enqueue a notice
5)  Set MessageQueueMode to "process nothing"
6)  Run process_message_queue.pl
7)  Note nothing happens, 0 message reported
8)  Set MessageQueueMode to "process plugin hooks only"
9)  Run process_message_queue.pl
10) Note nothing happens, 0 message reported
11) Set MessageQueueMode to "on"
12) Run process_message_queue.pl
13) Note the message fails to send, assuming you have not set
    up anything to actually send messages on your test instance
Comment 3 Kyle M Hall (khall) 2024-09-19 18:32:46 UTC
Created attachment 171789 [details] [review]
Bug 37885: Add ability to disable message queue processing

There exist services that libraries utilize as an alternative to processing the message queue.
These services may utilize the queued messages and send them from outside of Koha.
Sometimes these services utilize the API or reports while other times they utilize a plugin.
It would be beneficial to be able to disable running the message queue processor altogether,
or to only execute the plugin hook related to message queue processing ( before_send_messages )
to limit the processing of messages to those handled by plugins.

Test Plan:
1)  Apply this patch
2)  Run updatedatabase.pl
3)  Install the kitchen sink plugin, enable it
4)  Enqueue a notice
5)  Set MessageQueueMode to "process nothing"
6)  Run process_message_queue.pl
7)  Note nothing happens, 0 message reported
8)  Set MessageQueueMode to "process plugin hooks only"
9)  Run process_message_queue.pl
10) Note nothing happens, 0 message reported
11) Set MessageQueueMode to "on"
12) Run process_message_queue.pl
13) Note the message fails to send, assuming you have not set
    up anything to actually send messages on your test instance
Comment 4 Baptiste Wojtkowski (bwoj) 2025-03-06 16:10:23 UTC
Created attachment 179019 [details] [review]
Bug 37885: Add ability to disable message queue processing

There exist services that libraries utilize as an alternative to processing the message queue.
These services may utilize the queued messages and send them from outside of Koha.
Sometimes these services utilize the API or reports while other times they utilize a plugin.
It would be beneficial to be able to disable running the message queue processor altogether,
or to only execute the plugin hook related to message queue processing ( before_send_messages )
to limit the processing of messages to those handled by plugins.

Test Plan:
1)  Apply this patch
2)  Run updatedatabase.pl
3)  Install the kitchen sink plugin, enable it
4)  Enqueue a notice
5)  Set MessageQueueMode to "process nothing"
6)  Run process_message_queue.pl
7)  Note nothing happens, 0 message reported
8)  Set MessageQueueMode to "process plugin hooks only"
9)  Run process_message_queue.pl
10) Note nothing happens, 0 message reported
11) Set MessageQueueMode to "on"
12) Run process_message_queue.pl
13) Note the message fails to send, assuming you have not set
    up anything to actually send messages on your test instance
Comment 5 Baptiste Wojtkowski (bwoj) 2025-03-06 16:12:50 UTC
Rebased on main and could reproduce the test plan but not for "process plugin hooks only".

The notice I used is a message added from /cgi-bin/koha/circ/circulation.pl