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 $username = 'guest'; |
68 |
my $password = 'guest'; |
69 |
my $vhost = ''; |
70 |
my $config = C4::Context->config('message_broker'); |
71 |
if ($config){ |
72 |
$hostname = $config->{hostname} if $config->{hostname}; |
73 |
$port = $config->{port} if $config->{port}; |
74 |
$username = $config->{username} if $config->{username}; |
75 |
$password = $config->{password} if $config->{password}; |
76 |
$vhost = $config->{vhost} if $config->{vhost}; |
77 |
} |
78 |
my $stomp = Net::Stomp->new( { hostname => $hostname, port => $port } ); |
79 |
$stomp->connect( { login => $username, passcode => $password, host => $vhost } ); |
67 |
return $stomp; |
80 |
return $stomp; |
68 |
} |
81 |
} |
69 |
|
82 |
|