Bug 40820 - STOMP errors even when JobsNotificationMethod='polling'
Summary: STOMP errors even when JobsNotificationMethod='polling'
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on: 34070
Blocks:
  Show dependency treegraph
 
Reported: 2025-09-16 18:05 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-09-16 18:37 UTC (History)
4 users (show)

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


Attachments
Bug 40820: Fix STOMP connection warnings when JobsNotificationMethod is 'polling' (3.41 KB, patch)
2025-09-16 18:36 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 40820: (follow-up) es_indexer_daemon.pl missed on 34070 (1.89 KB, patch)
2025-09-16 18:36 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2025-09-16 18:05:15 UTC
We added the JobsNotificationMethod preference so people can disable the use of RabbitMQ explicitly and not get the logs flooded with connection errors.

But a patch on bug 34070 reintroduced the warn ♪┏(・o・)┛♪

e2e587273c14f092d71046f21266473445b219c5
Comment 1 Tomás Cohen Arazi (tcohen) 2025-09-16 18:36:29 UTC
Created attachment 186506 [details] [review]
Bug 40820: Fix STOMP connection warnings when JobsNotificationMethod is 'polling'

The background job workers are showing STOMP/RabbitMQ connection error
warnings even when the JobsNotificationMethod system preference was set
to 'polling', which doesn't require a message broker connection.

This patch adds checks for the JobsNotificationMethod preference before
displaying connection warnings, so warnings only appear when STOMP is
actually expected to be available.

Changes:
- misc/workers/background_jobs_worker.pl: Check syspref before warning
- misc/workers/es_indexer_daemon.pl: Check syspref before warning

Test plan:
1. Set JobsNotificationMethod to 'polling'
2. Run background_jobs_worker.pl - should not show STOMP warnings
3. Run es_indexer_daemon.pl - should not show STOMP warnings
4. Set JobsNotificationMethod to 'STOMP' without RabbitMQ running
5. Run workers - should show appropriate STOMP connection warnings
6. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2025-09-16 18:36:34 UTC
Created attachment 186507 [details] [review]
Bug 40820: (follow-up) es_indexer_daemon.pl missed on 34070

The es_indexer_daemon.pl was missing handling for the case where
Koha::BackgroundJob->connect() returns undef without throwing
an exception (which happens when connection fails silently).

This adds the missing warning for that case, matching the behavior
in background_jobs_worker.pl.

Test plan:
1. Set JobsNotificationMethod to 'STOMP'
2. Configure invalid STOMP settings that cause connect() to return undef
3. Run es_indexer_daemon.pl - should show connection warning
4. Verify jobs are still processed via database polling

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>