-
-
Save ptupitsyn/7dacefd1cebb936d5f516d8afeba7efe to your computer and use it in GitHub Desktop.
Ignite streamer test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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