public RedisSubscriber(IConnectionMultiplexerFactory connectionFactory, IRedisSerializer serializer, FilterAttachedMessageHandlerFactory messageHandlerFactory, FilterAttachedAsyncMessageHandlerFactory asyncMessageHandlerFactory) { this.connectionFactory = connectionFactory; this.serializer = serializer; this.messageHandlerFactory = messageHandlerFactory; this.asyncMessageHandlerFactory = asyncMessageHandlerFactory; }
public RedisTransportListener( ConfigurationOptions redisConfiguration, IEnvelopeSerializer envelopeSerializer = null, ITraceWriter traceWriter = null, int acceptTransportBoundedCapacity = 10, IConnectionMultiplexerFactory connectionMultiplexerFactory = null, string channelNamespace = null) { if (redisConfiguration == null) { throw new ArgumentNullException(nameof(redisConfiguration)); } _redisConfiguration = redisConfiguration; _envelopeSerializer = envelopeSerializer ?? new JsonNetSerializer(); _traceWriter = traceWriter; _channelNamespace = channelNamespace ?? RedisTransport.DefaultChannelNamespace; _connectionMultiplexerFactory = connectionMultiplexerFactory ?? new ConnectionMultiplexerFactory(); _transportBufferBlock = new BufferBlock <ITransport>( new DataflowBlockOptions() { BoundedCapacity = acceptTransportBoundedCapacity }); _semaphore = new SemaphoreSlim(1, 1); _listenerChannelName = GetListenerChannelName(_channelNamespace, RedisTransport.ServerChannelPrefix); }
public RedisDataManager(RedisStreamOptions options, IConnectionMultiplexerFactory connectionMultiplexerFactory, ILogger loggerFactory, string queueName, string serviceId, string clusterId) : this( options, connectionMultiplexerFactory, loggerFactory, options.PersistenceLifetime == PersistenceLifetime.ServiceLifetime ? (serviceId + ":" + queueName) : (clusterId + ":" + queueName)) { }
/// <summary> /// Initializes a new <see cref="RedisSyncService"/>. /// </summary> /// <param name="logService">Service used for logging.</param> /// <param name="configStore">Configuration storage instance.</param> /// <param name="multiplexerFactory">Facory that is able to create instances of <see cref="IConnectionMultiplexer"/>.</param> public RedisSyncService( ILog logService, IConfigStore configStore, IConnectionMultiplexerFactory multiplexerFactory) { this.logService = logService; this.configStore = configStore; this.multiplexerFactory = multiplexerFactory; }
public RedisGrainStorage(string name, RedisGrainStorageOptions options, ILogger logger, IOptions <ClusterOptions> clusterOptions, ISerializationManager serializationManager, IConnectionMultiplexerFactory connectionMultiplexerFactory) { _name = name; _options = options; _logger = logger ?? SilentLogger.Logger; _serializationManager = serializationManager; _clusterOptions = clusterOptions.Value; _connectionMultiplexerFactory = connectionMultiplexerFactory; }
private RedisDataManager(RedisStreamOptions options, IConnectionMultiplexerFactory connectionMultiplexerFactory, ILogger logger, string queueName) { queueName = SanitizeQueueName(queueName); ValidateQueueName(queueName); _options = options; _connectionMultiplexerFactory = connectionMultiplexerFactory; _logger = logger.ForContext <RedisDataManager>(); QueueName = queueName; _redisChannel = new RedisChannel(QueueName, RedisChannel.PatternMode.Literal); }
public RedisQueueAdapter( RedisStreamOptions options, IConnectionMultiplexerFactory connectionMultiplexerFactory, IRedisDataAdapter dataAdapter, IStreamQueueMapper streamQueueMapper, ILogger logger, string serviceId, string clusterId, string providerName) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (connectionMultiplexerFactory == null) { throw new ArgumentNullException(nameof(connectionMultiplexerFactory)); } if (dataAdapter == null) { throw new ArgumentNullException(nameof(dataAdapter)); } if (streamQueueMapper == null) { throw new ArgumentNullException(nameof(streamQueueMapper)); } if (string.IsNullOrEmpty(serviceId)) { throw new ArgumentNullException(nameof(serviceId)); } if (string.IsNullOrEmpty(clusterId)) { throw new ArgumentNullException(nameof(clusterId)); } if (string.IsNullOrEmpty(providerName)) { throw new ArgumentNullException(nameof(providerName)); } _redisStreamOptions = options; _connectionMultiplexerFactory = connectionMultiplexerFactory; ServiceId = serviceId; ClusterId = clusterId; Name = providerName; _streamQueueMapper = streamQueueMapper; _dataAdapter = dataAdapter; _logger = logger.ForContext <RedisQueueAdapter>(new Dictionary <string, object> { { "ServiceId", serviceId }, { "ProviderName", providerName } }); }
public RedisTransport( ConfigurationOptions redisConfiguration, IEnvelopeSerializer envelopeSerializer = null, ITraceWriter traceWriter = null, IConnectionMultiplexerFactory connectionMultiplexerFactory = null, string channelNamespace = null) : this(envelopeSerializer, traceWriter, channelNamespace, ServerChannelPrefix, ClientChannelPrefix) { if (redisConfiguration == null) { throw new ArgumentNullException(nameof(redisConfiguration)); } _redisConfiguration = redisConfiguration; _connectionMultiplexerFactory = connectionMultiplexerFactory ?? new ConnectionMultiplexerFactory(); }
public RedisTransport( Uri uri, IEnvelopeSerializer envelopeSerializer = null, ITraceWriter traceWriter = null, IConnectionMultiplexerFactory connectionMultiplexerFactory = null, string channelNamespace = null) : this(ConfigurationOptions.Parse(uri?.DnsSafeHost), envelopeSerializer, traceWriter, connectionMultiplexerFactory, channelNamespace) { if (uri == null) { throw new ArgumentNullException(nameof(uri)); } if (!uri.Scheme.Equals(RedisScheme, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException($"Invalid URI scheme. Expected is '{RedisScheme}'.", nameof(uri)); } }
public RedisQueueAdapter( RedisStreamOptions options, IConnectionMultiplexerFactory connectionMultiplexerFactory, IRedisDataAdapter dataAdapter, IStreamQueueMapper streamQueueMapper, ILogger logger, string serviceId, string providerName) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (connectionMultiplexerFactory == null) { throw new ArgumentNullException(nameof(connectionMultiplexerFactory)); } if (dataAdapter == null) { throw new ArgumentNullException(nameof(dataAdapter)); } if (streamQueueMapper == null) { throw new ArgumentNullException(nameof(streamQueueMapper)); } if (string.IsNullOrEmpty(serviceId)) { throw new ArgumentNullException(nameof(serviceId)); } if (string.IsNullOrEmpty(providerName)) { throw new ArgumentNullException(nameof(providerName)); } _redisStreamOptions = options; _connectionMultiplexerFactory = connectionMultiplexerFactory; ServiceId = serviceId; Name = providerName; _streamQueueMapper = streamQueueMapper; _dataAdapter = dataAdapter; _logger = (logger ?? SilentLogger.Logger).ForContext <RedisQueueAdapter>(); }
public RedisRandomPool(IConnectionMultiplexerFactory onnectionMultiplexerFactory) { _connectionMultiplexerFactory = onnectionMultiplexerFactory; }
public RedisDataManager(RedisStreamOptions options, IConnectionMultiplexerFactory connectionMultiplexerFactory, ILogger loggerFactory, string queueName, string serviceId) : this(options, connectionMultiplexerFactory, loggerFactory, serviceId + ":" + queueName) { }
public RedisQueueAdapterFactory( string name, RedisStreamOptions options, IConnectionMultiplexerFactory connectionMultiplexerFactory, HashRingStreamQueueMapperOptions queueMapperOptions, SimpleQueueCacheOptions cacheOptions, IServiceProvider serviceProvider, IOptions <ClusterOptions> clusterOptions, IRedisDataAdapter dataAdapter, ILogger logger, ISerializationManager serializationManager) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } if (connectionMultiplexerFactory == null) { throw new ArgumentNullException(nameof(connectionMultiplexerFactory)); } if (queueMapperOptions == null) { throw new ArgumentNullException(nameof(queueMapperOptions)); } if (cacheOptions == null) { throw new ArgumentNullException(nameof(cacheOptions)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (clusterOptions == null) { throw new ArgumentNullException(nameof(clusterOptions)); } if (dataAdapter == null) { throw new ArgumentNullException(nameof(dataAdapter)); } if (serializationManager == null) { throw new ArgumentNullException(nameof(serializationManager)); } _providerName = name; _options = options; _connectionMultiplexerFactory = connectionMultiplexerFactory; _clusterOptions = clusterOptions.Value; _logger = logger.ForContext <RedisQueueAdapterFactory>(); _dataAdapter = dataAdapter; _streamQueueMapper = new HashRingBasedStreamQueueMapper(queueMapperOptions, _providerName); var microsoftLoggerFactory = serviceProvider.GetService <Microsoft.Extensions.Logging.ILoggerFactory>(); _adapterCache = new SimpleQueueAdapterCache(cacheOptions, _providerName, microsoftLoggerFactory); }
public static IServiceCollection AddMessagePipeRedis(this IServiceCollection services, IConnectionMultiplexerFactory connectionMultiplexerFactory, Action <MessagePipeRedisOptions> configure) { var options = new MessagePipeRedisOptions(connectionMultiplexerFactory); configure(options); services.AddSingleton(options); // add as singleton instance services.AddSingleton <IConnectionMultiplexerFactory>(options.ConnectionMultiplexerFactory); services.AddSingleton <IRedisSerializer>(options.RedisSerializer); services.Add(typeof(IDistributedPublisher <,>), typeof(RedisPublisher <,>), InstanceLifetime.Singleton); services.Add(typeof(IDistributedSubscriber <,>), typeof(RedisSubscriber <,>), InstanceLifetime.Singleton); return(services); }
public static IServiceCollection AddMessagePipeRedis(this IServiceCollection services, IConnectionMultiplexerFactory connectionMultiplexerFactory) { return(AddMessagePipeRedis(services, connectionMultiplexerFactory, _ => { })); }
public ProxyCheckTaskRedisQueue(IConnectionMultiplexerFactory connectionMultiplexerFactory) { _connectionMultiplexerFactory = connectionMultiplexerFactory; }
public RedisSharedConnection(IConnectionMultiplexerFactory connectionMultiplexerFactory) { _connectionMultiplexerFactory = connectionMultiplexerFactory; CreateMultiplexer(); }
public RedisPublisher(IConnectionMultiplexerFactory connectionFactory, IRedisSerializer serializer) { this.connectionFactory = connectionFactory; this.serializer = serializer; }
public MessagePipeRedisOptions(IConnectionMultiplexerFactory connectionMultiplexerFactory) { this.RedisSerializer = new MessagePackRedisSerializer(); this.ConnectionMultiplexerFactory = connectionMultiplexerFactory; }
public RedisProxyPipieline(IConnectionMultiplexerFactory connectionMultiplexerFactory) { _connectionMultiplexerFactory = connectionMultiplexerFactory; }