Exemple #1
0
        public static IServiceCollection AddChunklerClient(this IServiceCollection services, Action <ChunklerClientOptions> configureOptions)
        {
            var options = new ChunklerClientOptions();

            configureOptions(options);
            return(AddChunklerClient(services, options));
        }
Exemple #2
0
        public ChunklerClient(ChunklerClientOptions options, ILogger logger)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));
            _logger  = logger ?? throw new ArgumentNullException(nameof(logger));

            _clusterClient = new ClientBuilder()
                             .UseLocalhostClustering()
                             .Configure <ClusterOptions>(cfg =>
            {
                cfg.ClusterId = options.ClusterOptions.ClusterId;
                cfg.ServiceId = options.ClusterOptions.ServiceId;
            })
                             .AddSimpleMessageStreamProvider(ChunklerConstants.SimpleChunkStreamProvider)
                             .Build();

            _clusterClient.Connect().Wait();
            _streamProvider = _clusterClient.GetStreamProvider(ChunklerConstants.SimpleChunkStreamProvider);
        }
Exemple #3
0
 public static IServiceCollection AddChunklerClient(this IServiceCollection services, ChunklerClientOptions options)
 {
     return(services
            .AddScoped <IChunklerClient, ChunklerClient>()
            .AddSingleton <ChunklerClientOptions>(options));
 }