public Producer( Guid correlationId, Uri serviceUrl, string topic, ulong initialSequenceId, IRegisterEvent registerEvent, IProducerChannel initialChannel, IExecute executor, IStateChanged <ProducerState> state, IProducerChannelFactory factory, ISchema <TMessage> schema) { var messageMetadataPolicy = new DefaultPooledObjectPolicy <PulsarApi.MessageMetadata>(); _messageMetadataPool = new DefaultObjectPool <PulsarApi.MessageMetadata>(messageMetadataPolicy); _correlationId = correlationId; ServiceUrl = serviceUrl; Topic = topic; _sequenceId = new SequenceId(initialSequenceId); _eventRegister = registerEvent; _channel = initialChannel; _executor = executor; _state = state; _factory = factory; _schema = schema; _isDisposed = 0; _eventRegister.Register(new ProducerCreated(_correlationId)); }
public Consumer( Guid correlationId, Uri serviceUrl, string subscriptionName, string topic, IRegisterEvent eventRegister, IConsumerChannel <TMessage> initialChannel, IExecute executor, IStateChanged <ConsumerState> state, IConsumerChannelFactory <TMessage> factory) { _correlationId = correlationId; ServiceUrl = serviceUrl; SubscriptionName = subscriptionName; Topic = topic; _eventRegister = eventRegister; _channel = initialChannel; _executor = executor; _state = state; _factory = factory; _commandAckPool = new DefaultObjectPool <CommandAck>(new DefaultPooledObjectPolicy <CommandAck>()); _isDisposed = 0; _eventRegister.Register(new ConsumerCreated(_correlationId)); }
public async ValueTask DisposeAsync() { if (Interlocked.Exchange(ref _isDisposed, 1) != 0) { return; } _eventRegister.Register(new ConsumerDisposed(_correlationId, this)); await _channel.DisposeAsync(); }
public async ValueTask DisposeAsync() { if (Interlocked.Exchange(ref _isDisposed, 1) != 0) { return; } _eventRegister.Register(new ProducerDisposed(_correlationId, this)); await _channel.DisposeAsync().ConfigureAwait(false); }
public async ValueTask DisposeAsync() { if (Interlocked.Exchange(ref _isDisposed, 1) != 0) { return; } _eventRegister.Register(new ReaderDisposed(_correlationId)); await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false); await _channel.DisposeAsync().ConfigureAwait(false); }
public Reader( Guid correlationId, IRegisterEvent eventRegister, IReaderChannel initialChannel, IExecute executor, IStateChanged <ReaderState> state) { _correlationId = correlationId; _eventRegister = eventRegister; _channel = initialChannel; _executor = executor; _state = state; _isDisposed = 0; _eventRegister.Register(new ReaderCreated(_correlationId, this)); }
public Consumer( Guid correlationId, IRegisterEvent eventRegister, IConsumerChannel initialChannel, IExecute executor, IStateChanged <ConsumerState> state) { _correlationId = correlationId; _eventRegister = eventRegister; _channel = initialChannel; _executor = executor; _state = state; _cachedCommandAck = new CommandAck(); _isDisposed = 0; _eventRegister.Register(new ConsumerCreated(_correlationId, this)); }
public Producer( Guid correlationId, string topic, IRegisterEvent registerEvent, IProducerChannel initialChannel, IExecute executor, IStateChanged <ProducerState> state) { _correlationId = correlationId; Topic = topic; _eventRegister = registerEvent; _channel = initialChannel; _executor = executor; _state = state; _isDisposed = 0; _eventRegister.Register(new ProducerCreated(_correlationId, this)); }
public Consumer( Guid correlationId, string topic, IRegisterEvent eventRegister, IConsumerChannel initialChannel, IExecute executor, IStateChanged <ConsumerState> state) { _correlationId = correlationId; Topic = topic; _eventRegister = eventRegister; _channel = initialChannel; _executor = executor; _state = state; _commandAckPool = new DefaultObjectPool <CommandAck>(new DefaultPooledObjectPolicy <CommandAck>()); _isDisposed = 0; _eventRegister.Register(new ConsumerCreated(_correlationId, this)); }
private async ValueTask <bool> Handle(Exception exception, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return(true); } var context = new ExceptionContext(exception, cancellationToken); await _exceptionHandler.OnException(context).ConfigureAwait(false); if (context.Result != FaultAction.Retry) { _eventRegister.Register(new ExecutorFaulted(_correlationId)); } return(context.Result == FaultAction.ThrowException ? throw context.Exception : context.Result == FaultAction.Rethrow); }
public Reader( Guid correlationId, Uri serviceUrl, string topic, IRegisterEvent eventRegister, IConsumerChannel initialChannel, IExecute executor, IStateChanged <ReaderState> state) { _correlationId = correlationId; ServiceUrl = serviceUrl; Topic = topic; _eventRegister = eventRegister; _channel = initialChannel; _executor = executor; _state = state; _isDisposed = 0; _eventRegister.Register(new ReaderCreated(_correlationId, this)); }
public Producer( Guid correlationId, string topic, ulong initialSequenceId, IRegisterEvent registerEvent, IProducerChannel initialChannel, IExecute executor, IStateChanged <ProducerState> state) { var messageMetadataPolicy = new DefaultPooledObjectPolicy <PulsarApi.MessageMetadata>(); _messageMetadataPool = new DefaultObjectPool <PulsarApi.MessageMetadata>(messageMetadataPolicy); _correlationId = correlationId; Topic = topic; _sequenceId = new SequenceId(initialSequenceId); _eventRegister = registerEvent; _channel = initialChannel; _executor = executor; _state = state; _isDisposed = 0; _eventRegister.Register(new ProducerCreated(_correlationId, this)); }
public SubProducer( Guid correlationId, Uri serviceUrl, string topic, IRegisterEvent registerEvent, IProducerChannel initialChannel, IExecute executor, IStateChanged <ProducerState> state, IProducerChannelFactory factory, ISchema <TMessage> schema) { _correlationId = correlationId; ServiceUrl = serviceUrl; Topic = topic; _eventRegister = registerEvent; _channel = initialChannel; _executor = executor; _state = state; _factory = factory; _schema = schema; _isDisposed = 0; _eventRegister.Register(new ProducerCreated(_correlationId)); }
public void Activated() => _eventRegister.Register(new ChannelActivated(_correlationId));