ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Kuznetsov <stku...@gmail.com>
Subject Re: Data Streamer not flushing data to cache
Date Sat, 31 Mar 2018 10:24:16 GMT
Hello!

The simplest way to ensure your data have got to the cache is to use
IgniteDataStreamer in try-with-resources block. I some rare scenarios it
can make sense to call {{flush()}} or {{close()}} on streamer instance
directly.

2018-03-31 12:38 GMT+03:00 begineer <rednirus@gmail.com>:

> Hi, This must be something very simple. I am adding 100 items to data
> streamer. But it is not flushing items to cache. Is there a settings much
> enables it. Cache size is zero. Am I doing something wrong ?
>
> public class DataStreamerExample {
> public static void main(String[] args) throws InterruptedException {
>         Ignite ignite = Ignition.start("examples/
> config/example-ignite.xml");
>         CacheConfiguration<Long, Long> config = new
> CacheConfiguration<>("mycache");
>         IgniteCache<Long, Long> cache = ignite.getOrCreateCache(config);
>         IgniteDataStreamer<Long, Long> streamer =
> ignite.dataStreamer("mycache");
>         LongStream.range(1, 100).forEach( l->{
>                 System.out.println("Adding to streamer "+ l);
>                 streamer.addData(l, l);
>         });
>         System.out.println(streamer.perNodeBufferSize());
>         System.out.println("Cache size : "+ cache.size(CachePeekMode.ALL))
> ;
>         cache.query(new ScanQuery<>()).getAll().stream().forEach(entry->{
>                 System.out.println("cache Entry: " + entry.getKey()+" "+
> entry.getValue());
>         });
> }
> }
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
  Andrey Kuznetsov.

Mime
View raw message