Esempio n. 1
0
 public HttpReceiveEndpointBuilder(IBusBuilder busBuilder, IHttpHost host, BusHostCollection <HttpHost> hosts, IHttpEndpointConfiguration configuration)
     : base(busBuilder, configuration)
 {
     _host          = host;
     _configuration = configuration;
     _hosts         = hosts;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of <see cref="CrowHost"/>.
 /// </summary>
 /// <param name="log">Instance of logger.</param>
 /// <param name="convention">Naming convention instance.</param>
 /// <param name="container">Dependency injection container.</param>
 /// <param name="configuration">Configuration helper.</param>
 /// <param name="host">Http host instance.</param>
 public CrowHost(ILog log, INamingConvention convention,
                 IInjectionContainer container,
                 IConfigurationHelper configuration,
                 IHttpHost host)
     : base(log, convention, container, configuration, host)
 {
 }
Esempio n. 3
0
 public HttpReceiveEndpointFactory(HttpBusBuilder builder, IHttpHost host, BusHostCollection <HttpHost> hosts, IHttpEndpointConfiguration configuration)
 {
     _builder       = builder;
     _host          = host;
     _hosts         = hosts;
     _configuration = configuration;
 }
        public void Start()
        {
            StopRunningHost();

            _host = _hostFactory(BaseUri);
            _host.Start();
        }
 public HttpReceiveEndpointSpecification(IHttpHost host, BusHostCollection <HttpHost> hosts, string pathMatch, IHttpEndpointConfiguration configuration)
     : base(configuration)
 {
     _host          = host;
     _hosts         = hosts;
     _pathMatch     = pathMatch;
     _configuration = configuration;
 }
 private void StopRunningHost()
 {
     if (_host != null)
     {
         _host.Stop();
         _host = null;
     }
 }
Esempio n. 7
0
 public HttpReceiveTransport(IHttpHost host, HttpReceiveEndpointContext context, ReceiveObservable receiveObservable,
                             ReceiveTransportObservable receiveTransportObservable, IPipe <HttpHostContext> hostPipe)
 {
     _host                       = host;
     _context                    = context;
     _receiveObservable          = receiveObservable;
     _receiveTransportObservable = receiveTransportObservable;
     _hostPipe                   = hostPipe;
 }
Esempio n. 8
0
        public HttpPublishEndpointProvider(IHttpHost host, IMessageSerializer serializer, ISendTransportProvider transportProvider, IPublishPipe publishPipe)
        {
            _host              = host;
            _serializer        = serializer;
            _transportProvider = transportProvider;
            _publishPipe       = publishPipe;

            _publishObservable = new PublishObservable();
        }
        public HttpReceiveTransport(IHttpHost host, ReceiveSettings receiveSettings, IHttpReceiveEndpointTopology topology)
        {
            _host            = host;
            _receiveSettings = receiveSettings;
            _topology        = topology;

            _receiveObservable          = new ReceiveObservable();
            _receiveTransportObservable = new ReceiveTransportObservable();
        }
        public HttpReceiveTransport(IHttpHost host, ReceiveSettings receiveSettings, ISendPipe sendPipe)
        {
            _host = host;
            _receiveSettings = receiveSettings;
            _sendPipe = sendPipe;

            _receiveObservable = new ReceiveObservable();
            _receiveTransportObservable = new ReceiveTransportObservable();
        }
Esempio n. 11
0
 public void Start()
 {
     if (UseRemoteMockService == false)
     {
         StopRunningHost();
         _host = _hostFactory(BaseUri);
         _host.Start();
     }
 }
Esempio n. 12
0
        public HttpReceiveTransport(IHttpHost host, ReceiveSettings receiveSettings, ISendPipe sendPipe)
        {
            _host            = host;
            _receiveSettings = receiveSettings;
            _sendPipe        = sendPipe;

            _receiveObservable          = new ReceiveObservable();
            _receiveTransportObservable = new ReceiveTransportObservable();
        }
Esempio n. 13
0
        public HttpReceiveTransport(IHttpHost host, ReceiveSettings receiveSettings, IPublishEndpointProvider publishEndpointProvider, ISendPipe sendPipe)
        {
            _host                    = host;
            _receiveSettings         = receiveSettings;
            _publishEndpointProvider = publishEndpointProvider;
            _sendPipe                = sendPipe;

            _receiveObservable          = new ReceiveObservable();
            _receiveTransportObservable = new ReceiveTransportObservable();
        }
        public HttpPublishEndpointProvider(IHttpHost host, IMessageSerializer serializer, ISendTransportProvider transportProvider, IPublishPipe publishPipe,
            ISendPipe sendPipe)
        {
            _host = host;
            _serializer = serializer;
            _transportProvider = transportProvider;
            _publishPipe = publishPipe;
            _sendPipe = sendPipe;

            _publishObservable = new PublishObservable();
        }
        public void ReceiveEndpoint(IHttpHost host, string queueName, Action <IHttpReceiveEndpointConfigurator> configure)
        {
            if (!_configuration.Hosts.TryGetHost(host, out var hostConfiguration))
            {
                throw new ArgumentException("The host was not configured on this bus", nameof(host));
            }

            var configuration = hostConfiguration.CreateReceiveEndpointConfiguration(queueName);

            ConfigureReceiveEndpoint(configuration, configure);
        }
Esempio n. 16
0
        public Robot(string name, ILogConfiguration logConfig, IRobotConfiguration configuration, IMessageBus bus, IEnumerable<IPart> parts, IHttpHost httpHost)
        {
            var loggerName = String.Format("Robot.{0}", name);
            _logger = logConfig.CreateLogger(loggerName);

            Name = name;
            Configuration = configuration;
            Parts = parts;
            HttpHost = httpHost;
            Bus = bus;
        }
Esempio n. 17
0
        public void ReceiveEndpoint(IHttpHost host, string pathMatch, Action <IHttpReceiveEndpointConfigurator> configure = null)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            var specification = new HttpReceiveEndpointSpecification(host, pathMatch);

            configure?.Invoke(specification);

            AddBusFactorySpecification(specification);
        }
Esempio n. 18
0
        private IMockProviderService GetSubject(int port = 1234, bool enableSsl = false)
        {
            _mockHttpHost   = Substitute.For <IHttpHost>();
            _fakeHttpClient = new FakeHttpClient();
            _mockHttpHostFactoryCallCount = 0;

            return(new MockProviderService(
                       (baseUri, mockContextService) =>
            {
                _mockHttpHostFactoryCallCount++;
                return _mockHttpHost;
            },
                       port,
                       enableSsl,
                       baseUri => _fakeHttpClient));
        }
        private IMockProviderService GetSubject(int port = 1234, bool enableSsl = false)
        {
            _mockHttpHost = Substitute.For<IHttpHost>();
            _fakeHttpClient = new FakeHttpClient();
            _mockHttpHostFactoryCallCount = 0;

            return new MockProviderService(
                (baseUri, mockContextService) =>
                {
                    _mockHttpHostFactoryCallCount++;
                    return _mockHttpHost;
                },
                port,
                enableSsl,
                baseUri => _fakeHttpClient);
        }
Esempio n. 20
0
        private IMockProviderService GetSubject(int port = 1234, bool enableSsl = false)
        {
            _mockHttpHost                 = Substitute.For <IHttpHost>();
            _fakeHttpMessageHandler       = new FakeHttpMessageHandler();
            _mockHttpHostFactoryCallCount = 0;

            return(new MockProviderService(
                       baseUri =>
            {
                _mockHttpHostFactoryCallCount++;
                return _mockHttpHost;
            },
                       port,
                       enableSsl,
                       baseUri => new AdminHttpClient(baseUri, _fakeHttpMessageHandler)));
        }
        public void ReceiveEndpoint(IHttpHost host, string pathMatch, Action <IHttpReceiveEndpointConfigurator> configure = null)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            var endpointSpecification = _configuration.CreateNewConfiguration();

            var specification = new HttpReceiveEndpointSpecification(host, _hosts, pathMatch, endpointSpecification);

            specification.ConnectConsumerConfigurationObserver(this);
            specification.ConnectSagaConfigurationObserver(this);

            configure?.Invoke(specification);

            AddBusFactorySpecification(specification);
        }
        public HttpReceiveEndpointTopology(IHttpEndpointConfiguration configuration, Uri inputAddress, IMessageSerializer serializer, IHttpHost host,
                                           BusHostCollection <HttpHost> hosts)
        {
            InputAddress = inputAddress;
            _serializer  = serializer;
            _host        = host;
            _hosts       = hosts;

            _send    = configuration.Topology.Send;
            _publish = configuration.Topology.Publish;

            _consumePipe = configuration.Consume.CreatePipe();
            _sendPipe    = configuration.Send.CreatePipe();
            _publishPipe = configuration.Publish.CreatePipe();

            _sendEndpointProvider    = new Lazy <ISendEndpointProvider>(CreateSendEndpointProvider);
            _publishEndpointProvider = new Lazy <IPublishEndpointProvider>(CreatePublishEndpointProvider);
            _sendTransportProvider   = new Lazy <ISendTransportProvider>(CreateSendTransportProvider);
        }
Esempio n. 23
0
        public void ReceiveEndpoint(IHttpHost host, IEndpointDefinition definition, IEndpointNameFormatter endpointNameFormatter,
                                    Action <IHttpReceiveEndpointConfigurator> configureEndpoint = null)
        {
            var queueName = definition.GetEndpointName(endpointNameFormatter ?? DefaultEndpointNameFormatter.Instance);

            if (!_configuration.Hosts.TryGetHost(host, out var hostConfiguration))
            {
                throw new ArgumentException("The host was not configured on this bus", nameof(host));
            }

            var configuration = hostConfiguration.CreateReceiveEndpointConfiguration(queueName);

            void Configure(IHttpReceiveEndpointConfigurator configurator)
            {
                definition.Configure(configurator);

                configureEndpoint?.Invoke(configurator);
            }

            ConfigureReceiveEndpoint(configuration, configuration.Configurator, Configure);
        }
Esempio n. 24
0
        protected override IBusControl CreateBus()
        {
            return(MassTransit.Bus.Factory.CreateUsingHttp(x =>
            {
                ConfigureBus(x);

                ConfigureHttpBus(x);

                Host = x.Host(HostAddress, h => h.Method = HttpMethod.Post);

                ConfigureHttpBusHost(x, Host);

                x.ReceiveEndpoint(Host, "", e =>
                {
                    ConfigureReceiveEndpoint(e);

                    ConfigureHttpReceiveEndpoint(e);

                    _inputQueueAddress = e.InputAddress;
                });
            }));
        }
Esempio n. 25
0
 public HttpReceiveEndpointBuilder(IHttpHost host, IConsumePipe consumePipe, IBusBuilder busBuilder)
     : base(consumePipe, busBuilder)
 {
     _host = host;
 }
 protected override void ConfigureHttpBusHost(IHttpBusFactoryConfigurator configurator, IHttpHost host)
 {
     configurator.ReceiveEndpoint(host, "/api", ep => ep.Consumer <HttpApiRequestConsumer>());
 }
 public HttpReceiveEndpointSpecification(IHttpHost host, string pathMatch, IConsumePipe consumePipe = null)
     : base(consumePipe)
 {
     _host = host;
     _pathMatch = pathMatch;
 }
Esempio n. 28
0
 public bool TryGetHost(IHttpHost host, out IHttpHostConfiguration hostConfiguration)
 {
     return(_hosts.TryGetHost(host, out hostConfiguration));
 }
Esempio n. 29
0
 /// <summary>
 /// Initializes before the host starts.
 /// </summary>
 protected override void BeforeHostStart(IHttpHost host, HttpMessageHandler handler, HttpSelfHostConfiguration configuration)
 {
     base.Host<ICrow>(); //register default crow documentation interface.
     base._FilteredUrlList.Add("favicon.ico");
     base.BeforeHostStart(host, handler, configuration);
 }
 public HttpReceiveEndpointBuilder(IHttpHost host, IConsumePipe consumePipe, IBusBuilder busBuilder)
     : base(consumePipe, busBuilder)
 {
     _host = host;
 }
Esempio n. 31
0
 protected virtual void ConfigureBus(IHttpBusFactoryConfigurator configurator)
 {
     Host = configurator.Host(_hostAddress, h => h.Method = HttpMethod.Post);
 }
Esempio n. 32
0
 public HttpReceiveTransport(IHttpHost host, HttpReceiveEndpointContext receiveEndpointContext, IPipe <HttpHostContext> hostPipe)
 {
     _host = host;
     _receiveEndpointContext = receiveEndpointContext;
     _hostPipe = hostPipe;
 }
Esempio n. 33
0
 private void StopRunningHost()
 {
     if (_host != null)
     {
         _host.Stop();
         _host = null;
     }
 }
 public void ReceiveEndpoint(IHttpHost host, IEndpointDefinition definition, IEndpointNameFormatter endpointNameFormatter,
                             Action <IHttpReceiveEndpointConfigurator> configureEndpoint = null)
 {
     _hostConfiguration.ReceiveEndpoint(definition, endpointNameFormatter, configureEndpoint);
 }
Esempio n. 35
0
 public HttpReceiveEndpointFactory(IHttpBusConfiguration configuration, IHttpHost host)
 {
     _host          = host;
     _configuration = configuration;
 }
Esempio n. 36
0
 public void Start()
 {
     StopRunningHost();
     _host = _hostFactory(new Uri(BaseUri), new MockContextService(GetMockInteractions));
     _host.Start();
 }
Esempio n. 37
0
 protected virtual void ConfigureHttpBusHost(IHttpBusFactoryConfigurator configurator, IHttpHost host)
 {
     OnConfigureHttpBusHost?.Invoke(configurator, host);
 }
 public HttpReceiveEndpointFactory(HttpBusBuilder builder, IHttpHost host)
 {
     _builder = builder;
     _host = host;
 }
Esempio n. 39
0
 protected virtual void ConfigureHttpBusHost(IHttpBusFactoryConfigurator configurator, IHttpHost host)
 {
 }
 public void ReceiveEndpoint(IHttpHost host, string queueName, Action <IHttpReceiveEndpointConfigurator> configureEndpoint)
 {
     _hostConfiguration.ReceiveEndpoint(queueName, configureEndpoint);
 }
Esempio n. 41
0
 public void Start()
 {
     StopRunningHost();
     _host = _hostFactory(new Uri(BaseUri), new MockContextService(GetMockInteractions));
     _host.Start();
 }