Lines 16-21
package Koha::BackgroundJob;
Link Here
|
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
|
|
19 |
use Encode qw(); |
19 |
use JSON; |
20 |
use JSON; |
20 |
use Carp qw( croak ); |
21 |
use Carp qw( croak ); |
21 |
use Net::Stomp; |
22 |
use Net::Stomp; |
Lines 137-143
sub enqueue {
Link Here
|
137 |
# Also, here we just want the Koha instance's name, but it's not in the config... |
138 |
# Also, here we just want the Koha instance's name, but it's not in the config... |
138 |
# Picking a random id (memcached_namespace) from the config |
139 |
# Picking a random id (memcached_namespace) from the config |
139 |
my $namespace = C4::Context->config('memcached_namespace'); |
140 |
my $namespace = C4::Context->config('memcached_namespace'); |
140 |
$conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_queue), body => $json_args } ) |
141 |
my $encoded_args = Encode::encode_utf8( $json_args ); # FIXME We should better leave this to Net::Stomp? |
|
|
142 |
$conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_queue), body => $encoded_args } ) |
141 |
or Koha::Exceptions::Exception->throw('Job has not been enqueued'); |
143 |
or Koha::Exceptions::Exception->throw('Job has not been enqueued'); |
142 |
} catch { |
144 |
} catch { |
143 |
$self->status('failed')->store; |
145 |
$self->status('failed')->store; |
144 |
- |
|
|