public RabbitMQAdapterFactory(
            string name,
            RabbitMQStreamProviderOptions config,
            HashRingStreamQueueMapperOptions queueMapperOptions,
            SimpleQueueCacheOptions cacheOptions,
            IServiceProvider serviceProvider,
            IOptions <ClusterOptions> clusterOptions,
            SerializationManager serializationManager,
            ILoggerFactory loggerFactory,
            IMessageSerializationHandler serializationHandler,
            IRabbitMQMapper mapper)

        {
            _config = config;

            _providerName         = name;
            _loggeFactory         = loggerFactory;
            _serializationHandler = serializationHandler;

            _mapper = mapper;
            _mapper.Init( );

            _cacheSize    = cacheOptions.CacheSize;
            _adapterCache = new SimpleQueueAdapterCache(cacheOptions, _providerName, _loggeFactory);

            _streamQueueMapper = new HashRingBasedStreamQueueMapper(queueMapperOptions, _providerName);
        }
 public RabbitMQAdapterReceiver(RabbitMQStreamProviderOptions config, ILoggerFactory loggerFactory, QueueId queueId, string providerName, IRabbitMQMapper mapper)
 {
     _logger        = loggerFactory.CreateLogger(nameof(RabbitMQAdapterReceiver));
     _config        = config;
     _loggerFactory = loggerFactory;
     _queueId       = queueId;
     _mapper        = mapper;
     _providerName  = providerName;
 }
 public RabbitMQAdapter(RabbitMQStreamProviderOptions config, ILoggerFactory loggerFactory, string providerName, IStreamQueueMapper streamQueueMapper, IRabbitMQMapper mapper)
 {
     Direction          = config.Mode;
     _config            = config;
     _loggerFactory     = loggerFactory;
     Name               = providerName;
     _streamQueueMapper = streamQueueMapper;
     _mapper            = mapper;
     _queues            = new ConcurrentDictionary <QueueId, object>();
     CreateConnection();
 }
Beispiel #4
0
 public RabbitMQAdapterFactory(
     string name,
     RabbitMQStreamProviderOptions options,
     HashRingStreamQueueMapperOptions queueMapperOptions,
     SimpleQueueCacheOptions cacheOptions,
     IServiceProvider serviceProvider,
     IOptions <ClusterOptions> clusterOptions,
     SerializationManager serializationManager,
     ILoggerFactory loggerFactory)
 {
     providerName        = name;
     this.options        = options ?? throw new ArgumentNullException(nameof(options));
     this.clusterOptions = clusterOptions.Value;
     //this.SerializationManager = serializationManager ?? throw new ArgumentNullException(nameof(serializationManager));
     this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     streamQueueMapper  = new HashRingBasedStreamQueueMapper(queueMapperOptions, providerName);
     adapterCache       = new SimpleQueueAdapterCache(cacheOptions, providerName, this.loggerFactory);
     mapper             = ActivatorUtilities.GetServiceOrCreateInstance <TMapper>(serviceProvider);
 }
Beispiel #5
0
        public void Init(IProviderConfiguration config, string providerName, IServiceProvider serviceProvider)
        {
            _config       = serviceProvider.GetRequiredService <RabbitMQStreamProviderOptions>();
            _providerName = providerName;
            _loggeFactory = serviceProvider.GetRequiredService <ILoggerFactory>();

            _mapper = serviceProvider.GetRequiredService <IRabbitMQMapper>();
            _mapper.Init();

            _cacheSize    = SimpleQueueAdapterCache.ParseSize(config, 4096);
            _adapterCache = new SimpleQueueAdapterCache(_cacheSize, providerName, _loggeFactory);

            _streamQueueMapper = new HashRingBasedStreamQueueMapper(_config.NumberOfQueues, _providerName);

            if (StreamFailureHandlerFactory == null)
            {
                StreamFailureHandlerFactory =
                    qid => Task.FromResult <IStreamFailureHandler>(new NoOpStreamDeliveryFailureHandler(false));
            }
        }
 public static IQueueAdapterReceiver Create(RabbitMQStreamProviderOptions config, ILoggerFactory loggerFactory, QueueId queueId, string providerName, IRabbitMQMapper mapper)
 {
     return(new RabbitMQAdapterReceiver(config, loggerFactory, queueId, providerName, mapper));
 }
 public RabbitMQStreamProviderOptionsValidator(RabbitMQStreamProviderOptions rabbitMQStreamProviderOptions, string name)
 {
     this.rabbitMQStreamProviderOptions = rabbitMQStreamProviderOptions;
     this.name = name;
 }