Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mizrael committed Jun 7, 2024
1 parent 4880579 commit b1d2328
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/tools/EvenireDB.Tools.EventsGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using EvenireDB.Client;
using Microsoft.Extensions.DependencyInjection;
using System.CommandLine;
using System.Text;

var defaultServerUri = new Uri("http://localhost:5001");
var defaultEventsCount = 100;
Expand All @@ -18,7 +19,7 @@
description: $"Count of events to send. Defaults to {defaultEventsCount}.");

var streamIdOption = new Option<Guid>(
name: "--stream",
name: "--stream",
description: "The stream to use.");


Expand All @@ -29,7 +30,7 @@
eventsCount,
streamIdOption
};
rootCommand.SetHandler(async (streamId, uri, useGrpc, eventsCount) => {
rootCommand.SetHandler(async (streamId, uri, useGrpc, eventsCount) => {
var services = new ServiceCollection();
services.AddEvenireDB(new EvenireConfig(uri, useGrpc));

Expand All @@ -38,7 +39,8 @@

Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"Sending {eventsCount} events to stream '{streamId}' on server '{uri}'...");
var events = Enumerable.Range(0, eventsCount).Select(i => new EventData($"event-{i}", new byte[] { 42 })).ToArray();

var events = Enumerable.Range(0, eventsCount).Select(i => new EventData($"event-{i}", Encoding.UTF8.GetBytes($"event-{i}"))).ToArray();

try
{
Expand All @@ -48,9 +50,9 @@
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("an error has occurred while sending events: " + cliEx.Message);
}
}

Console.ForegroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Done.");

Console.ResetColor();
Expand Down

0 comments on commit b1d2328

Please sign in to comment.