Skip to content

Instantly share code, notes, and snippets.

@ptupitsyn
Last active November 14, 2019 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptupitsyn/7dacefd1cebb936d5f516d8afeba7efe to your computer and use it in GitHub Desktop.
Save ptupitsyn/7dacefd1cebb936d5f516d8afeba7efe to your computer and use it in GitHub Desktop.
Ignite streamer test
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Apache.Ignite" Version="2.7.6" />
</ItemGroup>
</Project>
using System;
using Apache.Ignite.Core;
namespace ConsoleApp6
{
class Program
{
static void Main(string[] args)
{
var cfg = new IgniteConfiguration
{
ClientMode = true
};
using (var ignite = Ignition.Start(cfg))
{
var cache = ignite.GetOrCreateCache<long, Foo>("stream-test");
using (var streamer = ignite.GetDataStreamer<long, Foo>(cache.Name))
{
long l = 0;
while (true)
{
l++;
streamer.AddData(l, new Foo(l));
if (l % 1000 == 0)
{
Console.WriteLine(l);
}
}
}
}
}
}
public class Foo
{
public long Id { get; set; }
public string B { get; set; }
public string C { get; set; }
public Foo(long id)
{
Id = id;
B = Guid.NewGuid().ToString();
C = Guid.NewGuid().ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment