# connect up
my %template = %{$app->config->{'Engine::Stomp'}};
- my $add_header = delete $template{subscribe_header};
- if (ref($add_header) ne 'HASH') {
- $add_header = undef;
- }
+ my $subscrine_headers = $template{subscribe_headers} || {};
+ die("subscribe_headers config for Engine::Stomp must be a hashref!\n")
+ if (ref($subscribe_headers) ne 'HASH');
+
$self->connection(Net::Stomp->new(\%template));
$self->connection->connect();
$self->conn_desc($template{hostname}.':'.$template{port});
# subscribe, with client ack.
foreach my $queue (@queues) {
my $queue_name = "/queue/$queue";
- my $header_hash = {
+ $self->connection->subscribe({
+ %$subscribe_headers,
destination => $queue_name,
ack => 'client',
- };
-
- # add the additional headers - yes I know it overwrites but
- # thats the dev's problem?
- if (keys %{$add_header}) {
- foreach my $key (keys %{$add_header}) {
- $header_hash->{$key} = $add_header->{$key};
- }
- }
-
- $self->connection->subscribe($header_hash);
+ });
}
# enter loop...