protected BaseReceiveEndpointContext(IHostConfiguration hostConfiguration, IReceiveEndpointConfiguration configuration)
        {
            _hostConfiguration = hostConfiguration;

            InputAddress           = configuration.InputAddress;
            HostAddress            = configuration.HostAddress;
            PublishFaults          = configuration.PublishFaults;
            PrefetchCount          = configuration.PrefetchCount;
            ConcurrentMessageLimit = configuration.ConcurrentMessageLimit;

            _publishTopology = configuration.Topology.Publish;

            ConsumePipeSpecification = configuration.Consume.Specification;

            SendObservers    = new SendObservable();
            PublishObservers = new PublishObservable();

            _endpointObservers  = configuration.EndpointObservers;
            _receiveObservers   = configuration.ReceiveObservers;
            _transportObservers = configuration.TransportObservers;

            Dependencies = configuration.Dependencies;

            _sendPipe    = new Lazy <ISendPipe>(() => configuration.Send.CreatePipe());
            _publishPipe = new Lazy <IPublishPipe>(() => configuration.Publish.CreatePipe());
            _receivePipe = new Lazy <IReceivePipe>(configuration.CreateReceivePipe);

            _serializer = new Lazy <IMessageSerializer>(() => configuration.Serialization.Serializer);

            Reset();

            hostConfiguration.ConnectReceiveEndpointContext(this);
        }
        protected BaseReceiveEndpointContext(IHostConfiguration hostConfiguration, IReceiveEndpointConfiguration configuration)
        {
            InputAddress = configuration.InputAddress;
            HostAddress  = configuration.HostAddress;

            _publishTopology = configuration.Topology.Publish;

            ConsumePipeSpecification = configuration.Consume.Specification;

            _logContext = LogContext.Current.CreateLogContext(LogCategoryName.Transport.Receive);

            SendObservers    = new SendObservable();
            PublishObservers = new PublishObservable();

            _endpointObservers  = configuration.EndpointObservers;
            _receiveObservers   = configuration.ReceiveObservers;
            _transportObservers = configuration.TransportObservers;

            Dependencies = configuration.Dependencies;

            _sendPipe    = new Lazy <ISendPipe>(() => configuration.Send.CreatePipe());
            _publishPipe = new Lazy <IPublishPipe>(() => configuration.Publish.CreatePipe());
            _receivePipe = new Lazy <IReceivePipe>(configuration.CreateReceivePipe);

            _serializer               = new Lazy <IMessageSerializer>(() => configuration.Serialization.Serializer);
            _sendEndpointProvider     = new Lazy <ISendEndpointProvider>(CreateSendEndpointProvider);
            _publishEndpointProvider  = new Lazy <IPublishEndpointProvider>(CreatePublishEndpointProvider);
            _sendTransportProvider    = new Lazy <ISendTransportProvider>(CreateSendTransportProvider);
            _publishTransportProvider = new Lazy <IPublishTransportProvider>(CreatePublishTransportProvider);

            hostConfiguration.ConnectReceiveContextContext(this);
        }
Exemplo n.º 3
0
 public MediatorSendEndpoint(IReceiveEndpointConfiguration configuration, IReceivePipeDispatcher dispatcher, ILogContext logContext,
                             SendObservable sendObservers, IReceiveEndpointConfiguration sourceConfiguration, IReceivePipeDispatcher sourceDispatcher)
     : this(configuration, dispatcher, logContext, sendObservers)
 {
     _sourceAddress  = sourceConfiguration.InputAddress;
     _sourceEndpoint = new MediatorSendEndpoint(sourceConfiguration, sourceDispatcher, logContext, sendObservers);
 }
        public KafkaTopicReceiveEndpointConfiguration(IKafkaHostConfiguration hostConfiguration, ConsumerConfig consumerConfig, string topic,
                                                      IBusInstance busInstance, IReceiveEndpointConfiguration endpointConfiguration, IHeadersDeserializer headersDeserializer)
            : base(endpointConfiguration)
        {
            _hostConfiguration     = hostConfiguration;
            _busInstance           = busInstance;
            _endpointConfiguration = endpointConfiguration;
            _consumerConfig        = consumerConfig;
            _options = new OptionsSet();
            Topic    = topic;

            if (!SerializationUtils.DeSerializers.IsDefaultKeyType <TKey>())
            {
                SetKeyDeserializer(new MassTransitJsonDeserializer <TKey>());
            }
            SetValueDeserializer(new MassTransitJsonDeserializer <TValue>());
            SetHeadersDeserializer(headersDeserializer);

            CheckpointInterval     = TimeSpan.FromMinutes(1);
            CheckpointMessageCount = 5000;
            MessageLimit           = 10000;
            ConcurrencyLimit       = 1;

            _consumerConfigurator = new PipeConfigurator <ConsumerContext <TKey, TValue> >();
        }
        public WebJobMessageReceiverEndpointContext(IReceiveEndpointConfiguration configuration, IBinder binder, CancellationToken cancellationToken)
            : base(configuration)
        {
            _binder            = binder;
            _cancellationToken = cancellationToken;

            _publishTopology = configuration.Topology.Publish;
        }
Exemplo n.º 6
0
 public WebJobEventDataReceiverSpecification(IBinder binder, IReceiveEndpointConfiguration endpointConfiguration,
                                             CancellationToken cancellationToken = default(CancellationToken))
     : base(endpointConfiguration)
 {
     _binder = binder;
     _endpointConfiguration = endpointConfiguration;
     _cancellationToken     = cancellationToken;
 }
Exemplo n.º 7
0
 public ConsumerRegistrar(IConsumerFactory consumerFactory,
                          IConsumerTypeProvider consumerTypeProvider,
                          IReceiveEndpointConfiguration receiveEndpointConfiguration)
 {
     _consumerFactory              = consumerFactory;
     _consumerTypeProvider         = consumerTypeProvider;
     _receiveEndpointConfiguration = receiveEndpointConfiguration;
 }
Exemplo n.º 8
0
 public WebJobBrokeredMessageReceiverSpecification(IBinder binder, IReceiveEndpointConfiguration endpointConfiguration,
                                                   CancellationToken cancellationToken = default)
     : base(endpointConfiguration)
 {
     _binder = binder;
     _endpointConfiguration = endpointConfiguration;
     _cancellationToken     = cancellationToken;
 }
Exemplo n.º 9
0
 public WebJobEventDataReceiveEndpointContext(IReceiveEndpointConfiguration configuration, ILog log, IBinder binder,
                                              CancellationToken cancellationToken)
     : base(configuration)
 {
     _binder            = binder;
     _cancellationToken = cancellationToken;
     _log = log;
 }
Exemplo n.º 10
0
        public ConfigurationBusBuilder(IBusConfiguration configuration, IReceiveEndpointConfiguration busReceiveEndpointConfiguration,
                                       BusObservable busObservable)
        {
            _busEndpointSpecification = new ConfigurationReceiveEndpointSpecification(busReceiveEndpointConfiguration);
            _configuration            = configuration;
            _busEndpointConfiguration = busReceiveEndpointConfiguration;

            _busObservable = busObservable;
        }
        public WebJobMessageReceiverEndpointContext(IReceiveEndpointConfiguration configuration, Uri inputAddress, IBinder binder,
                                                    CancellationToken cancellationToken)
            : base(configuration)
        {
            _binder            = binder;
            _cancellationToken = cancellationToken;

            InputAddress = inputAddress ?? configuration.InputAddress;
        }
Exemplo n.º 12
0
        public ReceivePipeDispatcherConfiguration(IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            _endpointConfiguration = endpointConfiguration;

            InputAddress = endpointConfiguration.InputAddress;

            RethrowExceptions();
            ThrowOnDeadLetter();
        }
Exemplo n.º 13
0
        protected ReceiveEndpointBuilder(IReceiveEndpointConfiguration configuration)
        {
            _configuration = configuration;

            _consumePipe = configuration.ConsumePipe;

            ReceiveObservers   = new ReceiveObservable();
            TransportObservers = new ReceiveTransportObservable();
            EndpointObservers  = new ReceiveEndpointObservable();
        }
        public ReceivePipeDispatcherConfiguration(IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            _endpointConfiguration = endpointConfiguration;

            InputAddress = endpointConfiguration.InputAddress;

            this.ThrowOnSkippedMessages();
            this.RethrowFaultedMessages();
        }
Exemplo n.º 15
0
        public WebJobMessageReceiverEndpointContext(IReceiveEndpointConfiguration configuration, ILog log, IBinder binder, CancellationToken cancellationToken,
                                                    ReceiveObservable receiveObservers, ReceiveTransportObservable transportObservers, ReceiveEndpointObservable endpointObservers)
            : base(configuration, receiveObservers, transportObservers, endpointObservers)
        {
            _binder            = binder;
            _cancellationToken = cancellationToken;
            _log = log;

            _publishTopology = configuration.Topology.Publish;
        }
Exemplo n.º 16
0
        protected ReceiverConfiguration(IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            _configuration = endpointConfiguration;

            Specifications = new List <IReceiveEndpointSpecification>();

            this.ThrowOnSkippedMessages();
            this.RethrowFaultedMessages();
        }
Exemplo n.º 17
0
        public MassTransitMediator(ILogContext logContext, IReceiveEndpointConfiguration configuration, IReceivePipeDispatcher dispatcher,
                                   IReceiveEndpointConfiguration responseConfiguration, IReceivePipeDispatcher responseDispatcher)
        {
            var sendObservable = new SendObservable();

            _endpoint = new MediatorSendEndpoint(configuration, dispatcher, logContext, sendObservable, responseConfiguration, responseDispatcher);

            var clientFactoryContext = new MediatorClientFactoryContext(_endpoint, responseConfiguration.ConsumePipe, responseConfiguration.InputAddress);

            _clientFactory = new ClientFactory(clientFactoryContext);
        }
 public KafkaReceiveEndpointBuilder(IBusInstance busInstance, IReceiveEndpointConfiguration configuration,
                                    IKafkaHostConfiguration hostConfiguration, ReceiveSettings receiveSettings, IHeadersDeserializer headersDeserializer,
                                    Func <ConsumerBuilder <TKey, TValue> > consumerBuilderFactory)
     : base(configuration)
 {
     _busInstance            = busInstance;
     _configuration          = configuration;
     _hostConfiguration      = hostConfiguration;
     _receiveSettings        = receiveSettings;
     _headersDeserializer    = headersDeserializer;
     _consumerBuilderFactory = consumerBuilderFactory;
 }
Exemplo n.º 19
0
        public MediatorConfiguration(IHostConfiguration hostConfiguration, IReceiveEndpointConfiguration endpointConfiguration)
            : base(hostConfiguration, endpointConfiguration)
        {
            _hostConfiguration = hostConfiguration;

            if (_hostConfiguration.LogContext == null)
            {
                LogContext.ConfigureCurrentLogContext();

                _hostConfiguration.LogContext = LogContext.Current;
            }
        }
        public WebJobBrokeredMessageReceiverSpecification(IBinder binder, ILogger logger, IServiceBusReceiveEndpointConfiguration endpointConfiguration,
                                                          CancellationToken cancellationToken = default)
            : base(endpointConfiguration)
        {
            _binder = binder;
            _endpointConfiguration = endpointConfiguration;
            _cancellationToken     = cancellationToken;

            LogContext.ConfigureCurrentLogContext(logger);

            RethrowExceptions();
            ThrowOnDeadLetter();
        }
Exemplo n.º 21
0
        public WebJobEventDataReceiveEndpointContext(IReceiveEndpointConfiguration configuration, ILog log, IBinder binder,
                                                     CancellationToken cancellationToken, ReceiveObservable receiveObservers, ReceiveTransportObservable transportObservers,
                                                     ReceiveEndpointObservable endpointObservers)
            : base(configuration, receiveObservers, transportObservers, endpointObservers)
        {
            _binder            = binder;
            _cancellationToken = cancellationToken;
            _log = log;

            _publishTopology = configuration.Topology.Publish;

            _sendTransportProvider = new Lazy <ISendTransportProvider>(CreateSendTransportProvider);
        }
 public EventHubReceiveEndpointContext(IEventHubHostConfiguration hostConfiguration, IBusInstance busInstance,
                                       IReceiveEndpointConfiguration endpointConfiguration,
                                       ReceiveSettings receiveSettings, Func <IStorageSettings, BlobContainerClient> blobContainerClientFactory,
                                       Func <IHostSettings, BlobContainerClient, EventProcessorClient> clientFactory,
                                       Func <PartitionClosingEventArgs, Task> partitionClosingHandler,
                                       Func <PartitionInitializingEventArgs, Task> partitionInitializingHandler)
     : base(busInstance.HostConfiguration, endpointConfiguration)
 {
     _busInstance       = busInstance;
     _contextSupervisor = new Recycle <IProcessorContextSupervisor>(() =>
                                                                    new ProcessorContextSupervisor(hostConfiguration.ConnectionContextSupervisor, busInstance.HostConfiguration, receiveSettings,
                                                                                                   blobContainerClientFactory, clientFactory, partitionClosingHandler, partitionInitializingHandler));
 }
Exemplo n.º 23
0
        public MassTransitBus(IBusHostControl host, IBusObserver busObservable, IReceiveEndpointConfiguration endpointConfiguration)
        {
            Address          = endpointConfiguration.InputAddress;
            _consumePipe     = endpointConfiguration.ConsumePipe;
            _host            = host;
            _busObservable   = busObservable;
            _receiveEndpoint = endpointConfiguration.ReceiveEndpoint;

            Topology = host.Topology;

            _logContext = LogContext.Current;

            _publishEndpoint = new PublishEndpoint(_receiveEndpoint);
        }
Exemplo n.º 24
0
        MediatorSendEndpoint(IReceiveEndpointConfiguration configuration, IReceivePipeDispatcher dispatcher, ILogContext logContext,
                             SendObservable sendObservers)
        {
            _dispatcher    = dispatcher;
            _logContext    = logContext;
            _sendObservers = sendObservers;

            _destinationAddress = configuration.InputAddress;
            _publishTopology    = configuration.Topology.Publish;
            _receiveObservers   = configuration.ReceiveObservers;

            _sendPipe            = configuration.Send.CreatePipe();
            _publishSendEndpoint = new MediatorPublishSendEndpoint(this, configuration.Publish.CreatePipe());
        }
Exemplo n.º 25
0
        public KafkaReceiveEndpointContext(IBusInstance busInstance, IReceiveEndpointConfiguration endpointConfiguration,
                                           IKafkaHostConfiguration hostConfiguration,
                                           ReceiveSettings receiveSettings,
                                           IHeadersDeserializer headersDeserializer,
                                           Func <ConsumerBuilder <TKey, TValue> > consumerBuilderFactory)
            : base(busInstance.HostConfiguration, endpointConfiguration)
        {
            _busInstance = busInstance;
            _settings    = receiveSettings;

            _consumerContext = new Recycle <IConsumerContextSupervisor <TKey, TValue> >(() =>
                                                                                        new ConsumerContextSupervisor <TKey, TValue>(hostConfiguration.ClientContextSupervisor, _settings, busInstance.HostConfiguration,
                                                                                                                                     headersDeserializer, consumerBuilderFactory));
        }
Exemplo n.º 26
0
        protected ReceiverConfiguration(IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            _configuration = endpointConfiguration;

            Specifications = new List <IReceiveEndpointSpecification>();

            if (LogContext.Current == null)
            {
                LogContext.ConfigureCurrentLogContext();
            }

            this.ThrowOnSkippedMessages();
            this.RethrowFaultedMessages();
        }
Exemplo n.º 27
0
        public MassTransitBus(IBusHostControl host, IBusObserver busObservable, IReceiveEndpointConfiguration endpointConfiguration)
        {
            Address      = endpointConfiguration.InputAddress;
            _consumePipe = endpointConfiguration.ConsumePipe;
            _consumePipeSpecification = endpointConfiguration.Consume.Specification;
            _host            = host;
            _busObservable   = busObservable;
            _receiveEndpoint = endpointConfiguration.ReceiveEndpoint;

            Topology = host.Topology;

            _logContext = LogContext.Current;

            _publishEndpoint = new Lazy <IPublishEndpoint>(() => _receiveEndpoint.CreatePublishEndpoint(Address));
        }
        public EventHubReceiveEndpointConfigurator(string eventHubName, string consumerGroup, IHostSettings hostSettings, IStorageSettings storageSettings,
                                                   IBusInstance busInstance,
                                                   IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            _eventHubName          = eventHubName;
            _consumerGroup         = consumerGroup;
            _hostSettings          = hostSettings;
            _storageSettings       = storageSettings;
            _busInstance           = busInstance;
            _endpointConfiguration = endpointConfiguration;

            CheckpointInterval     = TimeSpan.FromMinutes(1);
            CheckpointMessageCount = 5000;
            ConcurrencyLimit       = 1;
        }
Exemplo n.º 29
0
        protected void ConfigureReceiveEndpoint <T>(IReceiveEndpointConfiguration configuration, T configurator,
                                                    Action <T> configure)
            where T : IReceiveEndpointConfigurator
        {
            configuration.ConnectConsumerConfigurationObserver(this);
            configuration.ConnectSagaConfigurationObserver(this);
            configuration.ConnectHandlerConfigurationObserver(this);

            configure?.Invoke(configurator);

            EndpointObservable.EndpointConfigured(configurator);

            var specification = new ConfigurationReceiveEndpointSpecification(configuration);

            _endpointSpecifications.Add(specification);
        }
        public EventHubReceiveEndpointConfigurator(IEventHubHostConfiguration hostConfiguration, string eventHubName, string consumerGroup,
                                                   IBusInstance busInstance,
                                                   IReceiveEndpointConfiguration endpointConfiguration)
            : base(endpointConfiguration)
        {
            EventHubName           = eventHubName;
            ConsumerGroup          = consumerGroup;
            _hostConfiguration     = hostConfiguration;
            _busInstance           = busInstance;
            _endpointConfiguration = endpointConfiguration;
            ConcurrencyLimit       = 1;

            CheckpointInterval     = TimeSpan.FromMinutes(1);
            CheckpointMessageCount = 5000;

            _processorConfigurator = new PipeConfigurator <ProcessorContext>();
        }