public ExperimentWithMethodsSaga(IKafkaProducer kafkaProducer, IConfiguration configuration) { _kafkaProducer = kafkaProducer; Configuration = configuration; EXPERIMENTS_TOPIC = Configuration["ExperimentsTopic"]; METHODS_TOPIC = Configuration["MethodsTopic"]; }
public KafkaMessageBus(IServiceProvider serviceProvider, ILogger <KafkaMessageBus> logger, KafkaMessageBusOptions kafkaOptions) { _serviceProvider = serviceProvider; _logger = logger; _kafkaOptions = kafkaOptions; this._producer = new KafkaProducer <string, KafkaMessageBusData>(this._serviceProvider); }
public MethodCommandHandlers(IMethodRepository repository, IKafkaProducer kafkaProducer, IConfiguration configuration) { _repository = repository; _kafkaProducer = kafkaProducer; Configuration = configuration; METHODS_TOPIC = Configuration["MethodsTopic"]; }
public IKafkaProducer <TKey, TValue> CreateProducer() { Logger.LogDebug($"Registering producer for topic '{Settings.Topic}'"); Logger.LogTrace(JsonConvert.SerializeObject(Settings)); if (_producerRegistrations != null) { return(_producerRegistrations); } lock (_lockObject) { if (_producerRegistrations != null) { return(_producerRegistrations); } var producerBuilder = CreateProducerBuilder(); SetKeySerializer(producerBuilder); SetValueSerializer(producerBuilder); var producer = producerBuilder.Build(); _producerRegistrations = CreateKafkaProducer(producer, Settings.Topic); } return(_producerRegistrations); }
public BBRService(IOptions <AppSettings> appSettings, ILogger <BBRService> logger, IKafkaProducer kakfkaProducer, IFTPClient ftpClient) { _appSettings = appSettings.Value; _logger = logger; _client = ftpClient; _producer = kakfkaProducer; }
public ExperimentCommandHandlers(IExperimentRepository repository, IKafkaProducer kafkaProducer, IConfiguration configuration) { _repository = repository; _kafkaProducer = kafkaProducer; Configuration = configuration; EXPERIMENT_TOPIC = Configuration["ExperimentsTopic"]; }
public AddressService(IOptions <AppSettings> appSettings, ILogger <AddressService> logger, IFTPClient ftpClient, IKafkaProducer kafkaProducer) { _appSettings = appSettings.Value; _client = ftpClient; _kafkaProducer = kafkaProducer; _logger = logger; }
/// <remarks> /// Used for calling base constructor for create BoundedConcurrentQueue /// </remarks> private KafkaSink(ITextFormatter formatter, KafkaOptions kafkaOptions, int batchSizeLimit, TimeSpan period, int queueLimit) : base(batchSizeLimit, period, queueLimit) { _formatter = formatter; _producer = new KafkaProducer(kafkaOptions); _stringWriterPool = new StringWriterPool(10, 500, 5_000); }
private async Task <CdcState> SetInitialStateAsync(CancellationToken token, IKafkaProducer producer, string executionId, TableSchema tableSchema, TimeSpan maxInterval) { byte[] initialToLsn = await _cdcReaderClient.GetMaxLsnAsync(); var existingOffset = await _cdcReaderClient.GetLastCdcOffsetAsync(executionId, tableSchema.TableName); if (existingOffset.Result == Result.NoStoredState) { Console.WriteLine($"Table {tableSchema.TableName} - No previous stored LSN. Starting from first change"); var hasFirstChange = false; ChangeBatch syncBatch = null; ChangeRecord firstChange = null; while (!hasFirstChange && !token.IsCancellationRequested) { var initialFromLsn = await _cdcReaderClient.GetMinValidLsnAsync(tableSchema.TableName); initialToLsn = await _cdcReaderClient.GetMaxLsnAsync(); syncBatch = await _cdcReaderClient.GetChangeBatchAsync(tableSchema, initialFromLsn, initialToLsn, 1); if (syncBatch.Changes.Any()) { firstChange = syncBatch.Changes.First(); await producer.SendAsync(token, firstChange); hasFirstChange = true; } else { await Task.Delay(maxInterval); } } var cdcState = new CdcState() { FromLsn = firstChange.Lsn, FromSeqVal = firstChange.SeqVal, ToLsn = initialToLsn, UnfinishedLsn = syncBatch.MoreOfLastTransaction }; var offset = GetOffset(cdcState); await _cdcReaderClient.StoreCdcOffsetAsync(executionId, tableSchema.TableName, offset); return(cdcState); } else { Console.WriteLine($"Table {tableSchema.TableName} - Starting from stored LSN"); return(new CdcState() { FromLsn = existingOffset.State.Lsn, FromSeqVal = existingOffset.State.SeqVal, ToLsn = initialToLsn, UnfinishedLsn = existingOffset.State.UnfinishedLsn }); } }
public MirrorProcessor(IKafkaConsumer kafkaConsumer, IKafkaProducer kafkaProducer, IMirrorTopicHandler mirrorTopicHandler, IEnvironmentConfigProvider environmentConfigProvider) { _kafkaConsumer = kafkaConsumer; _kafkaProducer = kafkaProducer; _mirrorTopicHandler = mirrorTopicHandler; _config = environmentConfigProvider.GetEnvironmentConfig(); }
/// <summary>Publish message</summary> public static Task ProduceAsync <T>(this IKafkaProducer producer, T message) where T : class { var definition = TopicDefinition.FromType <T>(); var key = definition.GetMessageKey(message); return(producer.ProduceAsync(definition.Topic, message, key)); }
public ChatController(IProducer producer, IDistributedEventBus distributedEventBus, IChatAppServices chatAppServices, IKafkaProducer kafkaProducer) { _producer = producer; _distributedEventBus = distributedEventBus; _chatAppServices = chatAppServices; _kafkaProducer = kafkaProducer; }
public HomeController(IConfiguration configuration, IKafkaProducer kafkaProducer, ILogger <KafkaProducer> logger) { _kafkaProducer = kafkaProducer; Configuration = configuration; EXPERIMENTS_TOPIC = Configuration["ExperimentsTopic"]; METHODS_TOPIC = Configuration["MethodsTopic"]; _logger = logger; }
public EventBus( IMediator mediator, IKafkaProducer producer ) { this.mediator = mediator; this.producer = producer; }
public AppService( DataContext context, IKafkaProducer k, CoreBankingService c) { _dbContext = context; kafkaProducer = k; coreBankingService = c; }
public CriarPaymentHandler(IUnitOfWork unitOfWork, IMapper mapper, IWebHook webHook, IPayAtOperatorService payAtOperatorService, KafkaProducer kafkaProducer) { _unitOfWork = unitOfWork; _mapper = mapper; _payAtOperatorService = payAtOperatorService; _webHook = webHook; _kafkaProducer = kafkaProducer; }
public KafkaRoatpDataReceiver( IKafkaProducer <string, ApprenticeshipProvider> producer, DataServicePlatformConfiguration configuration, ILogger <KafkaRoatpDataReceiver> logger) { _producer = producer; _configuration = configuration; _logger = logger; }
public TransactionService( ITransactionRepository repository, IKafkaProducer kafkaProducer, IKafkaConfigurationProvider kafkaConfigurationProvider) { _repository = repository; _kafkaProducer = kafkaProducer; _topic = kafkaConfigurationProvider.Get().Topic; }
public KafkaProducerApiUkrlpDataReceiver( IKafkaProducer<string, Provider> producer, DataServicePlatformConfiguration configuration, ILogger<KafkaProducerApiUkrlpDataReceiver> logger) { _producer = producer; _configuration = configuration; _logger = logger; }
public PlaceOrderUseCase( ICustomerReadOnlyRepository customerReadOnlyRepository, IOrderWriteRepository orderWriteOnlyRepository, IKafkaProducer kafkaProducer) { _customerReadOnlyRepository = customerReadOnlyRepository; _orderWriteOnlyRepository = orderWriteOnlyRepository; _kafkaProducer = kafkaProducer; }
public ProductService(IProductRepository productRepository , IBusClient busClient , IKafkaProducer kafkaProducerService , ILogger <ProductService> logger) { _productRepository = productRepository; _busClient = busClient; _kafkaProducerService = kafkaProducerService; _logger = logger; }
public KafkaAsyncCollector(string topic, IKafkaProducer producer) { if (producer == null) { throw new ArgumentNullException(nameof(producer)); } this.topic = topic; this.producer = producer; }
public ExperimentWithMethodsHandler( ISagaCoordinator sagaCoordinator, ISagaLog sagaLogData, IKafkaProducer kafkaProducer, IConfiguration configuration) { _sagaCoordinator = sagaCoordinator; _kafkaProducer = kafkaProducer; Configuration = configuration; EXPERIMENTS_TOPIC = Configuration["ExperimentsTopic"]; METHODS_TOPIC = Configuration["MethodsTopic"]; SagaLogData = sagaLogData; }
public CreateOrderCommandHandler( IItemRepository itemRepository, IOrderRepository orderRepository, IKafkaMessageService <CreatePaymentRequest, CreatePaymentResponse> kafkaMessageService, IKafkaProducer <PaymentRequestJson> kafkaJsonSvc, IMediator mediator) { _mediator = mediator; _kafkaMessageService = kafkaMessageService; _kafkaJsonSvc = kafkaJsonSvc; _itemRepository = itemRepository; _orderRepository = orderRepository; }
public KafkaMessageBus(IServiceProvider serviceProvider, ILogger <KafkaMessageBus> logger, KafkaMessageBusOptions kafkaOptions) { _serviceProvider = serviceProvider; _logger = logger; _kafkaOptions = kafkaOptions; if ((kafkaOptions.ClientMode & ClientMode.Producer) == ClientMode.Producer) { this._producer = new KafkaProducer <Null, MessageBusData>(serviceProvider); } if ((kafkaOptions.ClientMode & ClientMode.Consumer) == ClientMode.Consumer) { //消费者连接订阅时再创建 } }
private async Task <long> PublishAsync(IKafkaProducer producer, CancellationToken token, FullLoadBatch batch, long ctr) { foreach (var row in batch.Records) { var change = new ChangeRecord(); change.ChangeKey = row.ChangeKey; change.ChangeType = ChangeType.INSERT; change.LsnStr = ctr.ToString(); change.SeqValStr = ctr.ToString(); change.Data = row.Data; await producer.SendAsync(token, change); ctr++; } return(ctr); }
public KafkaProducerController(IConfiguration configuration, ILogger <KafkaProducerController> logger, IKafkaProducer producer, ISynchronzationUtil synchronzationUtil, IKafkaConsumer consumer, IMapper mapper) { this._configuration = configuration; this._logger = logger; this._producer = producer; this._synchronzationUtil = synchronzationUtil; this._consumer = consumer; //this._consumerThread = consumerThread; this._mapper = mapper; //_consumerThread.StartConsumerThread(); topicName = _configuration["ConfigProperties:Kafka:TopicName"]; _logger.LogInformation("Constructor called"); }
internal KafkaRawMessagePublisher( Func <IKafkaProducer> producerFunc, KafkaOptions options) { _options = options ?? throw new ArgumentNullException(nameof(options)); var producer = producerFunc(); try { _options.Publisher.ProducerCreatedCallback?.Invoke(producer.KafkaProducer); } catch { producer.Dispose(); throw; } _producer = producer; }
public KycService( IKycRepository kycRepository, IMrzProcessor mrzProcessor, IVerifier verifier, IMapper mapper, IKafkaProducer <string, InitiateKycResponseModel> initiateKycProducer, IKafkaProducer <string, CheckMrzStatusResponseModel> checkMrzStatusProducer, IKafkaProducer <string, VerificationResponseModel> verificationProducer) { _kycRepository = Guard.IsNotNull(kycRepository, nameof(kycRepository)); _mrzProcessor = Guard.IsNotNull(mrzProcessor, nameof(mrzProcessor)); _verifier = Guard.IsNotNull(verifier, nameof(verifier)); _mapper = Guard.IsNotNull(mapper, nameof(mapper)); _initiateKycProducer = Guard.IsNotNull(initiateKycProducer, nameof(initiateKycProducer)); _checkMrzStatusProducer = Guard.IsNotNull(checkMrzStatusProducer, nameof(checkMrzStatusProducer)); _verificationProducer = Guard.IsNotNull(verificationProducer, nameof(verificationProducer)); }
public async Task <PersistenceStatus> SynchronizeSelectionSummary([FromBody] SynchronizeSelectionSummaryRequestModel request) { DeliveryResult <Null, string> dr = null; using (IKafkaProducer <Null, string> p = this._kafkaProducerProvider.GetKafkaProducer <Null, string>("producer-synchronization")) { try { dr = await p.ProduceAsync(new Message <Null, string> { Value = request.ToJSON() }); _logger.LogInformation($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'"); } catch (ProduceException <Null, string> e) { _logger.LogError($"Delivery failed: {e.Error.Reason}"); } } return(dr.Status); }
public IKafkaProducer CreateProducer(NotNullOrWhiteSpaceString topic) { if (Producer == null) Producer = Substitute.For<IKafkaProducer>(); return Producer; }