Perl client for NATS Streaming Messaging System
Hello all,
With micro-services and cloud being a buzzwords of the day it's no surprise that a market for messaging systems is pretty busy at the moment.
One such system (NATS and persistent version NATS Streaming) seems to be a leader among relatively new arrivals. If interested please read more on it at its official page nats.io.
There's a lot of clients for original NATS already exist on the market, including one for Perl,
Net::NATS::Client, though without support for recently added NATS Streaming. I did not think that was optimal and wrote one.
The purpose of this blog post is the announcement of new Perl Client for NATS streaming I just uploaded to CPAN and github Net::NATS::Streaming::Client.
From the README.
Net::NATS::Streaming::Client - A Perl client for the NATS Streaming messaging system.
Basic Usage This class is a subclass of Net::NATS::Client and delegates all networking to the parent. use Net::NATS::Streaming::Client; $client = Net::NATS::Streaming::Client->new( uri => 'nats://localhost:4222'
); $client->connect() or die $!; $subscription = $client->subscribe_channel( { subject => 'foo' }, sub { warn shift->data }
);
$client->publish_channel( { subject => 'foo', data => 'Hello, World!'}
); $client->unsubscribe_channel($subscription); $client->close_stream();
Hopefully it'll be useful for Perl community.
Leave a comment