コード例 #1
0
        public static RabbitMqBatchContainer FromQueueMessage(IBatchContainerSerializer serializer, byte[] data, long sequenceId, ulong deliveryTag)
        {
            var batchContainer = serializer.Deserialize(data);

            batchContainer.EventSequenceToken = new EventSequenceToken(sequenceId);
            batchContainer.DeliveryTag        = deliveryTag;
            return(batchContainer);
        }
コード例 #2
0
 public RabbitMqAdapter(RabbitMqOptions rmqOptions, CachingOptions cachingOptions, IBatchContainerSerializer serializer, IStreamQueueMapper mapper, string providerName, ILoggerFactory loggerFactory)
 {
     _serializer          = serializer;
     _mapper              = mapper;
     Name                 = providerName;
     _rmqConnectorFactory = new RabbitMqOnlineConnectorFactory(rmqOptions, loggerFactory);
     _cacheFillingTimeout = cachingOptions.CacheFillingTimeout;
 }
 public RabbitMqAdapterReceiver(IRabbitMqConnectorFactory rmqConnectorFactory, QueueId queueId, IBatchContainerSerializer serializer, TimeSpan cacheFillingTimeout)
 {
     _rmqConnectorFactory = rmqConnectorFactory;
     _queueId             = queueId;
     _serializer          = serializer;
     _cacheFillingTimeout = cacheFillingTimeout;
     _logger     = _rmqConnectorFactory.LoggerFactory.CreateLogger($"{typeof(RabbitMqAdapterReceiver).FullName}.{queueId}");
     _sequenceId = 0;
 }
        public static byte[] ToQueueMessage <T>(
            IBatchContainerSerializer serializer,
            Guid streamGuid,
            string streamNamespace,
            IEnumerable <T> events,
            Dictionary <string, object> requestContext)
        {
            var container = new RabbitMQBatchContainer(streamGuid, streamNamespace, events.Cast <object>().ToList(), requestContext);

            return(serializer.Serialize(container));
        }