示例#1
0
        public StreamPersistentSubscription(
            EventStoreClient eventStoreClient,
            StreamPersistentSubscriptionOptions options,
            IEnumerable <IEventHandler> eventHandlers,
            IEventSerializer?eventSerializer = null,
            ILoggerFactory?loggerFactory     = null,
            ISubscriptionGapMeasure?measure  = null
            ) : base(
                eventStoreClient,
                options,
                new NoOpCheckpointStore(),
                eventHandlers,
                eventSerializer,
                loggerFactory,
                measure
                )
        {
            Ensure.NotEmptyString(options.Stream, nameof(options.Stream));

            var settings   = eventStoreClient.GetSettings().Copy();
            var opSettings = settings.OperationOptions.Clone();

            options.ConfigureOperation?.Invoke(opSettings);
            settings.OperationOptions = opSettings;

            _subscriptionClient           = new EventStorePersistentSubscriptionsClient(settings);
            _handleEventProcessingFailure = options.FailureHandler ?? DefaultEventProcessingFailureHandler;
            _options = options;
        }
示例#2
0
    protected PersistentSubscriptionBase(EventStoreClient eventStoreClient, T options, ConsumePipe consumePipe)
        : base(eventStoreClient, options, consumePipe)
    {
        var settings   = eventStoreClient.GetSettings().Copy();
        var opSettings = settings.OperationOptions.Clone();

        settings.OperationOptions = opSettings;

        SubscriptionClient = new EventStorePersistentSubscriptionsClient(settings);

        _handleEventProcessingFailure = options.FailureHandler ?? DefaultEventProcessingFailureHandler;

        if (options.FailureHandler != null && !options.ThrowOnError)
        {
            Log.ThrowOnErrorIncompatible(SubscriptionId);
        }
    }