my $notification_method = C4::Context->preference('JobsNotificationMethod') // 'STOMP';
my $conn;
my ( $conn, $error );
if ( $notification_method eq 'STOMP' ) {
try {
$conn = Koha::BackgroundJob->connect;
} catch {
warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_;
$error = sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_;
};
$error ||= "Cannot connect to the message broker, the jobs will be processed anyway" unless $conn;
warn $error if $error;
}
if ($conn) {
-