Example #1
0
        /// <summary>
        /// Configure <see cref="IEventProcessorStates"/> to be using Redis
        /// </summary>
        /// <param name="eventProcessorStatesConfiguration"><see cref="EventProcessorStatesConfiguration">Configuration instance</see> to configure</param>
        /// <param name="connectionStrings"></param>
        /// <returns>Chained <see cref="EventProcessorStatesConfiguration"/></returns>
        public static EventProcessorStatesConfiguration UsingRedis(this EventProcessorStatesConfiguration eventProcessorStatesConfiguration, params string[] connectionStrings)
        {
            eventProcessorStatesConfiguration.EventProcessorStates = typeof(EventProcessorStates);
            var configuration = new Redis.EventProcessorStatesConfiguration(connectionStrings);

            Configure.Instance.Container.Bind(configuration);
            return(eventProcessorStatesConfiguration);
        }
        /// <summary>
        /// Initializes a new instance of <see cref="EventProcessorStates"/>
        /// </summary>
        /// <param name="configuration">The <see cref="EventProcessorStatesConfiguration">configuration</see> to use</param>
        /// <param name="serializer"><see cref="ISerializer"/> to use for serializing state</param>
        /// <param name="systemClock"><see cref="ISystemClock"/> to use for time</param>
        public EventProcessorStates(EventProcessorStatesConfiguration configuration, ISerializer serializer, ISystemClock systemClock)
        {
            _serializer  = serializer;
            _systemClock = systemClock;
            var redis = ConnectionMultiplexer.Connect(string.Join(";", configuration.ConnectionStrings));

            _database = redis.GetDatabase();
        }