NAME
Plack::Handler::Stomp::NoNetwork - like Plack::Handler::Stomp, but without a network
VERSION
version 1.12
SYNOPSIS
my $runner = Plack::Handler::Stomp::NoNetwork->new({
trace_basedir => '/tmp/mq',
subscriptions => [
{ destination => '/queue/plack-handler-stomp-test' },
{ destination => '/topic/plack-handler-stomp-test',
path_info => '/topic/ch1', },
{ destination => '/topic/plack-handler-stomp-test',
path_info => '/topic/ch2', },
],
});
$runner->run(MyApp->get_app());
DESCRIPTION
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.
WARNING!
This class does not implement subscription selectors. If you have multiple subscriptions for the same destination, a random one will be used.
ATTRIBUTES
file_watcher
Instance of File::ChangeNotify::Watcher, set up to monitor trace_basedir
for sent messages.
frame_reader
Instance of Net::Stomp::MooseHelpers::ReadTrace used to parse frames from disk.
METHODS
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.
AUTHOR
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>
COPYRIGHT AND LICENSE
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.