Plack::Handler::Stomp::NoNetwork - like Plack::Handler::Stomp, but without a network
version 0.1_01
my $runner = Plack::Handler::Stomp::NoNetwork->new({ trace_basedir => '/tmp/mq', subscriptions => [ { destination => '/queue/plack-handler-stomp-test' }, { destination => '/topic/plack-handler-stomp-test', headers => { selector => q{custom_header = '1' or JMSType = 'test_foo'}, }, path_info => '/topic/ch1', }, { destination => '/topic/plack-handler-stomp-test', headers => { selector => q{custom_header = '2' or JMSType = 'test_bar'}, }, path_info => '/topic/ch2', }, ], }); $runner->run(MyApp->get_app());
Just like Plack::Handler::Stomp, but instead of using a network connection, we get our frames from a directory.
This class uses File::ChangeNotify to monitor the trace_basedir, and Net::Stomp::MooseHelpers::ReadTrace to read the frames.
It also consumes Net::Stomp::MooseHelpers::TraceOnly to make sure that every reply we try to send is actually written to disk instead of a broker.
This class does not implement subscription selectors. If you have multiple subscriptions for the same destination, a random one will be used.
file_watcher
Instance of File::ChangeNotify::Watcher, set up to monitor trace_basedir for sent messages.
trace_basedir
frame_reader
Instance of Net::Stomp::MooseHelpers::ReadTrace used to parse frames from disk.
frame_loop
This method ovverrides the corresponding one from Plack::Handler::Stomp.
Loop forever, collecting create events from the "file_watcher". Each new file is parsed by the "frame_reader", then passed to handle_stomp_frame as usual.
create
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>
This software is copyright (c) 2012 by Net-a-porter.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Plack::Handler::Stomp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Handler::Stomp
CPAN shell
perl -MCPAN -e shell install Plack::Handler::Stomp
For more information on module installation, please visit the detailed CPAN module installation guide.