Data-Enumerable-Lazy
view release on metacpan or search on metacpan
# do something with the queue item
}
In this example the client is blocked until there is an element
available in the queue, but it's hidden away from the clients who
consume the data item by item.
Kafka example
Kafka consumer wrapper is another example of a lazy calculation
application. Lazy enumerables are very naturally co-operated with
streaming data, like Kafka. In this example we're fetching batches of
messages from Kafka topic, grep out corrupted ones and proceed with the
mesages.
use Kafka qw($DEFAULT_MAX_BYTES);
use Kafka::Connection;
use Kafka::Consumer;
my $kafka_consumer = Kafka::Consumer->new(
Connection => Kafka::Connection->new( host => 'localhost', ),
);
lib/Data/Enumerable/Lazy.pm view on Meta::CPAN
# do something with the queue item
}
In this example the client is blocked until there is an element available in
the queue, but it's hidden away from the clients who consume the data item by
item.
=head2 Kafka example
Kafka consumer wrapper is another example of a lazy calculation application.
Lazy enumerables are very naturally co-operated with streaming data, like
Kafka. In this example we're fetching batches of messages from Kafka topic,
grep out corrupted ones and proceed with the mesages.
use Kafka qw($DEFAULT_MAX_BYTES);
use Kafka::Connection;
use Kafka::Consumer;
my $kafka_consumer = Kafka::Consumer->new(
Connection => Kafka::Connection->new( host => 'localhost', ),
);
( run in 0.262 second using v1.01-cache-2.11-cpan-4d50c553e7e )