Bugzilla – Attachment 171507 Details for
Bug 35655
Make it possible to switch off RabbitMQ without any warns in logs/about page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
full patch
patch (text/plain), 6.26 KB, created by
Mark Hofstetter
on 2024-09-14 12:10:37 UTC
(
hide
)
Description:
full patch
Filename:
MIME Type:
Creator:
Mark Hofstetter
Created:
2024-09-14 12:10:37 UTC
Size:
6.26 KB
patch
obsolete
>diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index 33a6872ec0..6e066e51c7 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -63,6 +63,10 @@ Connect to the message broker using default guest/guest credential > > sub connect { > my ( $self ); >+ my $notification_method = C4::Context->preference('JobsNotificationMethod') // 'STOMP'; >+ return undef >+ unless $notification_method eq 'STOMP'; >+ > my $hostname = 'localhost'; > my $port = '61613'; > my $config = C4::Context->config('message_broker'); >@@ -77,8 +81,17 @@ sub connect { > $credentials->{passcode} = $config->{password} if $config->{password}; > $credentials->{host} = $config->{vhost} if $config->{vhost}; > } >- my $stomp = Net::Stomp->new( { hostname => $hostname, port => $port } ); >- $stomp->connect( $credentials ); >+ >+ my $stomp; >+ >+ try { >+ $stomp = Net::Stomp->new( { hostname => $hostname, port => $port } ); >+ $stomp->connect( $credentials ); >+ } catch { >+ warn "Cannot connect to broker " . $_; >+ $stomp = undef; >+ }; >+ > return $stomp; > } > >@@ -123,12 +136,7 @@ sub enqueue { > > $job_args->{job_id} = $self->id; > >- my $conn; >- try { >- $conn = $self->connect; >- } catch { >- warn "Cannot connect to broker " . $_; >- }; >+ my $conn = $self->connect; > return $self->id unless $conn; > > $json_args = $json->encode($job_args); >diff --git a/about.pl b/about.pl >index 6233d8be23..c8ff0658b2 100755 >--- a/about.pl >+++ b/about.pl >@@ -906,10 +906,15 @@ sub message_broker_check { > my $template = shift; > { > # BackgroundJob - test connection to message broker >- eval { Koha::BackgroundJob->connect; }; >- if ($@) { >- warn $@; >- $template->param( warnConnectBroker => $@ ); >+ my $conn = Koha::BackgroundJob->connect; >+ if (! $conn) { >+ if (C4::Context->preference('JobsNotificationMethod') eq 'STOMP' ) { >+ $template->param( warnConnectBroker => 'Error connecting' ); >+ } else { >+ $template->param( >+ warnConnectBroker => C4::Context->preference('JobsNotificationMethod') >+ ); >+ } > } > } > } >diff --git a/installer/data/mysql/atomicupdate/bug_35655.pl b/installer/data/mysql/atomicupdate/bug_35655.pl >new file mode 100755 >index 0000000000..2755d70c8b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35655.pl >@@ -0,0 +1,22 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_failure say_success say_info); >+ >+return { >+ bug_number => "35655", >+ description => "Add a way to disable RabbitMQ", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences >+ (`variable`, `value`, `options`, `explanation`, `type` ) >+ VALUES >+ ('JobsNotificationMethod', 'STOMP', 'polling|STOMP', 'Define the preferred job worker notification method', 'Choice') >+ } >+ ); >+ >+ say $out "Added new system preference 'JobsNotificationMethod'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index a865f86cb2..54fbc47dac 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -358,6 +358,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('itemBarcodeInputFilter','','whitespace|T-prefix|cuecat|libsuite8|EAN13','If set, allows specification of a item barcode input filter','Choice'), > ('itemcallnumber','',NULL,'The MARC field/subfield that is used to calculate the itemcallnumber (Dewey would be 082ab or 092ab; LOC would be 050ab or 090ab) could be 852hi from an item record','free'), > ('ItemsDeniedRenewal','','','This syspref allows to define custom rules for denying renewal of specific items.','Textarea'), >+('JobsNotificationMethod','STOMP','polling|STOMP','Define the preferred job worker notification method','Choice'), > ('KohaAdminEmailAddress','root@localhost','','Define the email address where patron modification requests are sent','free'), > ('KohaManualBaseURL','https://koha-community.org/manual/','','Where is the Koha manual/documentation located?','Free'), > ('KohaManualLanguage','en','en|ar|cs|de|es|fr|it|pt_BR|tr|zh_TW','What is the language of the online manual you want to use?','Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 0713215662..13e7c652c3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -202,7 +202,9 @@ > </tr> > <tr> > <th scope="row">Message broker: </th> >- [% IF warnConnectBroker %] >+ [% IF warnConnectBroker == 'Error connecting' %] >+ <td class="text-bg-warning"><strong>Using SQL polling (Fallback, Error connecting to RabbitMQ)</strong></td> >+ [% ELSIF warnConnectBroker %] > <td class="text-bg-warning"><strong>Using SQL polling</strong></td> > [% ELSE %] > <td class="text-bg-info">Using RabbitMQ</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index 511341f044..b44075a9b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -189,6 +189,15 @@ Administration: > None: "None" > Common Name: Common Name > emailAddress: emailAddress >+ Jobs: >+ - >+ - "Use " >+ - pref: JobsNotificationMethod >+ default: STOMP >+ choices: >+ STOMP: "STOMP" >+ polling: "polling" >+ - as the preferred job worker notification method. STOMP (default) requires RabbitMQ running. Polling will be used as a fallback if RabbitMQ is not accessible. > Google OpenID Connect: > - > - "Use Google OpenID Connect login in the OPAC: "
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35655
:
171412
|
171413
|
171503
|
171504
|
171505
|
171506
|
171507
|
171509
|
171510
|
171511
|
171512
|
172027
|
172028
|
172029
|
172157
|
172158
|
172159
|
172232