X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FStomp.pm;h=5ac0d1df3205dec61720468753cb56ebd85a714b;hb=491ffbb309f6ef16c9fc47112d42c6144c2403c5;hp=89281a147b6e4ace35303c0b25f1d535787ff0a6;hpb=a58d0da647f09395c6b764446251d093c0f5116d;p=catagits%2FCatalyst-Engine-STOMP.git diff --git a/lib/Catalyst/Engine/Stomp.pm b/lib/Catalyst/Engine/Stomp.pm index 89281a1..5ac0d1d 100644 --- a/lib/Catalyst/Engine/Stomp.pm +++ b/lib/Catalyst/Engine/Stomp.pm @@ -82,10 +82,10 @@ sub run { # 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 $subscribe_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}); @@ -93,20 +93,11 @@ sub run { # 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... @@ -225,3 +216,30 @@ Add additional header key/value pairs to the subscribe message sent to the message broker. =cut + +=head1 DEVELOPMENT + +The source to Catalyst::Engine::Stomp is in github: + + http://github.com/chrisa/catalyst-engine-stomp + +=head1 AUTHOR + +Chris Andrews C<< >> + +=head1 CONTRIBUTORS + +Tomas Doran (t0m) C<< >> + +Jason Tang + +=head1 LICENCE AND COPYRIGHT + +Copyright (C) 2009 Venda Ltd + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.8.8 or, +at your option, any later version of Perl 5 you may have available. + +=cut +