| 1 | package AnyMQ::ZeroMQ; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | AnyMQ::ZeroMQ - AnyMQ adaptor for ZeroMQ | ||
| 6 | |||
| 7 | =cut | ||
| 8 | |||
| 9 | 1 | our $VERSION = '0.06'; | |
| 10 | |||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | # create a subscriber | ||
| 15 | my $sub_bus = AnyMQ->new_with_traits( | ||
| 16 | traits => [ 'ZeroMQ' ], | ||
| 17 | subscribe_address => 'tcp://localhost:4001', | ||
| 18 | ); | ||
| 19 | # subscribe to topic | ||
| 20 | my $sub_topic = $sub_bus->topic('ping'); | ||
| 21 | my $listener = $sub_bus->new_listener($sub_topic); | ||
| 22 | $listener->poll(sub { "got ping event!" }); | ||
| 23 | |||
| 24 | # create a publisher | ||
| 25 | my $pub_bus = AnyMQ->new_with_traits( | ||
| 26 | traits => ['ZeroMQ'], | ||
| 27 | publish_address => 'tcp://localhost:4000', # accepts any address that ZeroMQ supports | ||
| 28 | ); | ||
| 29 | my $pub_topic = $pub_bus->topic('ping'); | ||
| 30 | $pub_topic->publish({ foo => 'bar' }); | ||
| 31 | |||
| 32 | |||
| 33 | =head1 AUTHOR | ||
| 34 | |||
| 35 | Mischa Spiegelmock, C<< <revmischa at cpan.org> >> | ||
| 36 | |||
| 37 | =head1 BUGS | ||
| 38 | |||
| 39 | Please use the GitHub issue tracker | ||
| 40 | |||
| 41 | =head1 SEE ALSO | ||
| 42 | |||
| 43 | L<AnyMQ>, L<ZeroMQ::PubSub> | ||
| 44 | |||
| 45 | |||
| 46 | =head1 ACKNOWLEDGEMENTS | ||
| 47 | |||
| 48 | L<AnyMQ>, L<AnyEvent::ZeroMQ> | ||
| 49 | |||
| 50 | =head1 LICENSE AND COPYRIGHT | ||
| 51 | |||
| 52 | Copyright 2011 Mischa Spiegelmock. | ||
| 53 | |||
| 54 | This program is free software; you can redistribute it and/or modify it | ||
| 55 | under the terms of either: the GNU General Public License as published | ||
| 56 | by the Free Software Foundation; or the Artistic License. | ||
| 57 | |||
| 58 | See http://dev.perl.org/licenses/ for more information. | ||
| 59 | |||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | 1 | 1; # End of AnyMQ::ZeroMQ |