Exemplo n.º 1
0
        public ReaderChannelFactory(
            Guid correlationId,
            IRegisterEvent eventRegister,
            IConnectionPool connectionPool,
            IExecute executor,
            ReaderOptions options)
        {
            _correlationId        = correlationId;
            _eventRegister        = eventRegister;
            _connectionPool       = connectionPool;
            _executor             = executor;
            _messagePrefetchCount = options.MessagePrefetchCount;

            _subscribe = new CommandSubscribe
            {
                ConsumerName   = options.ReaderName,
                Durable        = false,
                ReadCompacted  = options.ReadCompacted,
                StartMessageId = options.StartMessageId.Data,
                Subscription   = "Reader-" + Guid.NewGuid().ToString("N"),
                Topic          = options.Topic
            };

            _batchHandler = new BatchHandler(false);
        }
Exemplo n.º 2
0
        public ConsumerChannel(
            ulong id,
            uint messagePrefetchCount,
            AsyncQueue <MessagePackage> queue,
            IConnection connection,
            BatchHandler batchHandler,
            IEnumerable <IDecompressorFactory> decompressorFactories)
        {
            _id           = id;
            _queue        = queue;
            _connection   = connection;
            _batchHandler = batchHandler;

            _decompressors = new IDecompress[5];

            foreach (var decompressorFactory in decompressorFactories)
            {
                _decompressors[(int)decompressorFactory.CompressionType] = decompressorFactory.Create();
            }

            _lock = new AsyncLock();

            _cachedCommandFlow = new CommandFlow
            {
                ConsumerId     = id,
                MessagePermits = messagePrefetchCount
            };

            _sendWhenZero = 0;
            _firstFlow    = true;
        }
Exemplo n.º 3
0
        public ConsumerChannelFactory(
            Guid correlationId,
            IRegisterEvent eventRegister,
            IConnectionPool connectionPool,
            IExecute executor,
            ConsumerOptions options)
        {
            _correlationId        = correlationId;
            _eventRegister        = eventRegister;
            _connectionPool       = connectionPool;
            _executor             = executor;
            _messagePrefetchCount = options.MessagePrefetchCount;

            _subscribe = new CommandSubscribe
            {
                ConsumerName    = options.ConsumerName,
                InitialPosition = (CommandSubscribe.InitialPositionType)options.InitialPosition,
                PriorityLevel   = options.PriorityLevel,
                ReadCompacted   = options.ReadCompacted,
                Subscription    = options.SubscriptionName,
                Topic           = options.Topic,
                Type            = (CommandSubscribe.SubType)options.SubscriptionType
            };

            _batchHandler = new BatchHandler(true);
        }
Exemplo n.º 4
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
            };
        }
Exemplo n.º 5
0
 public ConsumerChannel(
     ulong id,
     uint messagePrefetchCount,
     AsyncQueue <MessagePackage> queue,
     IConnection connection,
     BatchHandler batchHandler)
 {
     _id                = id;
     _queue             = queue;
     _connection        = connection;
     _batchHandler      = batchHandler;
     _cachedCommandFlow = new CommandFlow {
         ConsumerId = id, MessagePermits = messagePrefetchCount
     };
     _sendWhenZero = 0;
     _firstFlow    = true;
 }
Exemplo n.º 6
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
            };
        }
Exemplo n.º 7
0
 public ConsumerChannelFactory(
     Guid correlationId,
     IRegisterEvent eventRegister,
     IConnectionPool connectionPool,
     CommandSubscribe subscribe,
     uint messagePrefetchCount,
     BatchHandler <TMessage> batchHandler,
     IMessageFactory <TMessage> messageFactory,
     IEnumerable <IDecompressorFactory> decompressorFactories)
 {
     _correlationId         = correlationId;
     _eventRegister         = eventRegister;
     _connectionPool        = connectionPool;
     _subscribe             = subscribe;
     _messagePrefetchCount  = messagePrefetchCount;
     _batchHandler          = batchHandler;
     _messageFactory        = messageFactory;
     _decompressorFactories = decompressorFactories;
 }
Exemplo n.º 8
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;
 }