Example #1
0
 public ProducerStreamFactory(ConnectionPool connectionPool, ProducerOptions options, IFaultStrategy faultStrategy)
 {
     _connectionPool = connectionPool;
     _options        = options;
     _faultStrategy  = faultStrategy;
     _sequenceId     = new SequenceId(options.InitialSequenceId);
 }
Example #2
0
 internal PulsarClient(ConnectionPool connectionPool, IFaultStrategy faultStrategy)
 {
     _lock           = new object();
     _faultStrategy  = faultStrategy;
     _disposabels    = new LinkedList <IAsyncDisposable>();
     _connectionPool = connectionPool;
     _isClosed       = false;
 }
Example #3
0
 public Reader(IConsumerStreamFactory streamFactory, IFaultStrategy faultStrategy)
 {
     _stateManager       = new StateManager <ReaderState>(ReaderState.Disconnected, ReaderState.Closed, ReaderState.ReachedEndOfTopic, ReaderState.Faulted);
     _streamFactory      = streamFactory;
     _faultStrategy      = faultStrategy;
     _connectTokenSource = new CancellationTokenSource();
     Stream                  = new NotReadyStream();
     _connectTask            = Connect(_connectTokenSource.Token);
     _throwIfClosedOrFaulted = () => { };
 }
Example #4
0
 public Producer(IProducerStreamFactory streamFactory, IFaultStrategy faultStrategy)
 {
     _executor           = new Executor(ExecutorOnException);
     _streamFactory      = streamFactory;
     _faultStrategy      = faultStrategy;
     _stateManager       = new StateManager <ProducerState>(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Faulted);
     _connectTokenSource = new CancellationTokenSource();
     Stream                  = new NotReadyStream();
     _connectTask            = Connect(_connectTokenSource.Token);
     _throwIfClosedOrFaulted = () => { };
 }
Example #5
0
 public Consumer(IConsumerStreamFactory streamFactory, IFaultStrategy faultStrategy, bool setProxyState)
 {
     _executor           = new Executor(OnException);
     _cachedCommandAck   = new CommandAck();
     _stateManager       = new StateManager <ConsumerState>(ConsumerState.Disconnected, ConsumerState.Closed, ConsumerState.ReachedEndOfTopic, ConsumerState.Faulted);
     _streamFactory      = streamFactory;
     _faultStrategy      = faultStrategy;
     _setProxyState      = setProxyState;
     _connectTokenSource = new CancellationTokenSource();
     Stream                  = new NotReadyStream();
     _connectTask            = Connect(_connectTokenSource.Token);
     _throwIfClosedOrFaulted = () => { };
 }
Example #6
0
        public ConsumerStreamFactory(ConnectionPool connectionPool, ReaderOptions options, IFaultStrategy faultStrategy)
        {
            _connectionPool       = connectionPool;
            _faultStrategy        = faultStrategy;
            _messagePrefetchCount = options.MessagePrefetchCount;
            _batchHandler         = new BatchHandler(false);

            _subscribe = new CommandSubscribe
            {
                ConsumerName   = options.ReaderName,
                Durable        = false,
                ReadCompacted  = options.ReadCompacted,
                StartMessageId = options.StartMessageId.Data,
                Subscription   = "Reader-" + Guid.NewGuid().ToString("N"),
                Topic          = options.Topic
            };
        }
Example #7
0
        public ConsumerStreamFactory(ConnectionPool connectionPool, ConsumerOptions options, IFaultStrategy faultStrategy)
        {
            _connectionPool       = connectionPool;
            _faultStrategy        = faultStrategy;
            _messagePrefetchCount = options.MessagePrefetchCount;
            _batchHandler         = new BatchHandler(true);

            _subscribe = new CommandSubscribe
            {
                ConsumerName    = options.ConsumerName,
                initialPosition = (CommandSubscribe.InitialPosition)options.InitialPosition,
                PriorityLevel   = options.PriorityLevel,
                ReadCompacted   = options.ReadCompacted,
                Subscription    = options.SubscriptionName,
                Topic           = options.Topic,
                Type            = (CommandSubscribe.SubType)options.SubscriptionType
            };
        }
Example #8
0
        public ProducerStream(ulong id, string name, SequenceId sequenceId, Connection connection, IFaultStrategy faultStrategy, IProducerProxy proxy)
        {
            _cachedMetadata = new PulsarApi.MessageMetadata
            {
                ProducerName = name
            };

            var commandSend = new CommandSend
            {
                ProducerId  = id,
                NumMessages = 1
            };

            _cachedSendPackage = new SendPackage(commandSend, _cachedMetadata);

            _id            = id;
            _sequenceId    = sequenceId;
            _connection    = connection;
            _faultStrategy = faultStrategy;
            _proxy         = proxy;
        }
Example #9
0
 public ConsumerStream(
     ulong id,
     uint messagePrefetchCount,
     IDequeue <MessagePackage> dequeue,
     Connection connection,
     IFaultStrategy faultStrategy,
     IConsumerProxy proxy,
     BatchHandler batchHandler)
 {
     _id                = id;
     _dequeue           = dequeue;
     _connection        = connection;
     _faultStrategy     = faultStrategy;
     _proxy             = proxy;
     _batchHandler      = batchHandler;
     _cachedCommandFlow = new CommandFlow {
         ConsumerId = id, MessagePermits = messagePrefetchCount
     };
     _sendWhenZero = 0;
     _firstFlow    = true;
 }