View | Details | Raw Unified | Return to bug 26742
Collapse All | Expand All

(-)a/Koha/BackgroundJob.pm (-2 / +22 lines)
Lines 62-69 Connect to the message broker using default guest/guest credential Link Here
62
62
63
sub connect {
63
sub connect {
64
    my ( $self );
64
    my ( $self );
65
    my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } );
65
    my $hostname = 'localhost';
66
    $stomp->connect( { login => 'guest', passcode => 'guest' } );
66
    my $port = '61613';
67
    my $config = C4::Context->config('message_broker');
68
    my $credentials = {
69
        login => 'guest',
70
        passcode => 'guest',
71
    };
72
    if ($config){
73
        $hostname = $config->{hostname} if $config->{hostname};
74
        $port = $config->{port} if $config->{port};
75
        $credentials->{login} = $config->{username} if $config->{username};
76
        $credentials->{passcode} = $config->{password} if $config->{password};
77
        $credentials->{host} = $config->{vhost} if $config->{vhost};
78
    }
79
    my $stomp = Net::Stomp->new( { hostname => $hostname, port => $port } );
80
    my $frame = $stomp->connect( $credentials );
81
    unless ($frame && $frame->command eq 'CONNECTED'){
82
        if ($frame){
83
            warn $frame->as_string;
84
        }
85
        die "Cannot connect to message broker";
86
    }
67
    return $stomp;
87
    return $stomp;
68
}
88
}
69
89
(-)a/debian/templates/koha-conf-site.xml.in (+8 lines)
Lines 441-445 __END_SRU_PUBLICSERVER__ Link Here
441
    <debug>__SMTP_DEBUG__</debug>
441
    <debug>__SMTP_DEBUG__</debug>
442
 </smtp_server>
442
 </smtp_server>
443
443
444
 <message_broker>
445
   <hostname>localhost</hostname>
446
   <port>61613</port>
447
   <username>guest</username>
448
   <password>guest</password>
449
   <vhost></vhost>
450
 </message_broker>
451
444
</config>
452
</config>
445
</yazgfs>
453
</yazgfs>
(-)a/etc/koha-conf.xml (-1 / +8 lines)
Lines 258-262 Link Here
258
    <debug>__SMTP_DEBUG__</debug>
258
    <debug>__SMTP_DEBUG__</debug>
259
 </smtp_server>
259
 </smtp_server>
260
260
261
 <message_broker>
262
   <hostname>localhost</hostname>
263
   <port>61613</port>
264
   <username>guest</username>
265
   <password>guest</password>
266
   <vhost></vhost>
267
 </message_broker>
268
261
</config>
269
</config>
262
</yazgfs>
270
</yazgfs>
263
- 

Return to bug 26742