Example #1
0
 public ImmediatePublisher(ChannelExecutor executor, IModel model, PendingConfirmationCollection confirmations)
 {
     _executor      = executor;
     _model         = model;
     _confirmations = confirmations;
 }
Example #2
0
        public BatchConsumer(int messageLimit, TimeSpan timeLimit, ChannelExecutor executor, ChannelExecutor dispatcher, IPipe <ConsumeContext <Batch <TMessage> > > consumerPipe)
        {
            _messageLimit = messageLimit;
            _executor     = executor;
            _consumerPipe = consumerPipe;
            _dispatcher   = dispatcher;
            _messages     = new SortedDictionary <Guid, ConsumeContext <TMessage> >();
            _completed    = TaskUtil.GetTask <DateTime>();
            _firstMessage = DateTime.UtcNow;

            _timer = new Timer(TimeLimitExpired, null, timeLimit, TimeSpan.FromMilliseconds(-1));
        }
Example #3
0
 public SingleThreadSynchronizationContext(CancellationToken cancellationToken)
 {
     _cancellationToken = cancellationToken;
     _executor          = new ChannelExecutor(1);
 }
        async Task <ActiveMqConsumer> CreateConsumer(SessionContext context, string entityName, string selector, ushort prefetchCount, ChannelExecutor executor)
        {
            var queueName = $"{entityName}?consumer.prefetchSize={prefetchCount}";

            var queue = await context.GetQueue(queueName).ConfigureAwait(false);

            var messageConsumer = await context.CreateMessageConsumer(queue, selector, false).ConfigureAwait(false);

            LogContext.Debug?.Log("Created consumer for {InputAddress}: {Queue}", _context.InputAddress, queueName);

            var consumer = new ActiveMqConsumer(context, messageConsumer, _context, executor);

            await consumer.Ready.ConfigureAwait(false);

            return(consumer);
        }
Example #5
0
 public PartitionCheckpointData(TopicPartition partition, IConsumer <TKey, TValue> consumer, ReceiveSettings settings)
 {
     _pending      = new PendingConfirmationCollection(partition);
     _executor     = new ChannelExecutor(1);
     _checkpointer = new BatchCheckpointer <TKey, TValue>(_executor, consumer, settings);
 }
Example #6
0
        public async Task Should_be_low_impact()
        {
            var executor = new ChannelExecutor(1);

            await executor.DisposeAsync().ConfigureAwait(false);
        }