Esempio n. 1
0
        protected BusBuilder(IConsumePipeFactory consumePipeFactory, ISendPipeFactory sendPipeFactory,
            IPublishPipeFactory publishPipeFactory, IEnumerable<IBusHostControl> hosts)
        {
            _consumePipeFactory = consumePipeFactory;
            _sendPipeFactory = sendPipeFactory;
            _publishPipeFactory = publishPipeFactory;
            _hosts = hosts.ToArray();

            _deserializerFactories = new Dictionary<string, DeserializerFactory>(StringComparer.OrdinalIgnoreCase);
            _receiveEndpoints = new Dictionary<string, IReceiveEndpoint>();
            _serializerFactory = () => new JsonMessageSerializer();
            _busObservable = new BusObservable();
            _serializer = new Lazy<IMessageSerializer>(CreateSerializer);
            _sendTransportProvider = new Lazy<ISendTransportProvider>(CreateSendTransportProvider);

            _inputAddress = new Lazy<Uri>(GetInputAddress);
            _consumePipe = new Lazy<IConsumePipe>(GetConsumePipe);

            AddMessageDeserializer(JsonMessageSerializer.JsonContentType,
                (s, p) => new JsonMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(BsonMessageSerializer.BsonContentType,
                (s, p) => new BsonMessageDeserializer(BsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(XmlMessageSerializer.XmlContentType,
                (s, p) => new XmlMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
        }
Esempio n. 2
0
        protected BusBuilder(IConsumePipeFactory consumePipeFactory, ISendPipeFactory sendPipeFactory,
                             IPublishPipeFactory publishPipeFactory, IEnumerable <IBusHostControl> hosts)
        {
            _consumePipeFactory = consumePipeFactory;
            _sendPipeFactory    = sendPipeFactory;
            _publishPipeFactory = publishPipeFactory;
            _hosts = hosts.ToArray();

            _deserializerFactories = new Dictionary <string, DeserializerFactory>(StringComparer.OrdinalIgnoreCase);
            _receiveEndpoints      = new Dictionary <string, IReceiveEndpoint>();
            _serializerFactory     = () => new JsonMessageSerializer();
            _busObservable         = new BusObservable();
            _serializer            = new Lazy <IMessageSerializer>(CreateSerializer);
            _sendTransportProvider = new Lazy <ISendTransportProvider>(CreateSendTransportProvider);

            _inputAddress = new Lazy <Uri>(GetInputAddress);
            _consumePipe  = new Lazy <IConsumePipe>(GetConsumePipe);

            AddMessageDeserializer(JsonMessageSerializer.JsonContentType,
                                   (s, p) => new JsonMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(BsonMessageSerializer.BsonContentType,
                                   (s, p) => new BsonMessageDeserializer(BsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(XmlMessageSerializer.XmlContentType,
                                   (s, p) => new XmlMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
        }
        public InMemoryBusConfiguration(IInMemoryTopologyConfiguration topologyConfiguration, Uri baseAddress)
            : base(topologyConfiguration)
        {
            _hostConfiguration        = new InMemoryHostConfiguration(this, baseAddress, topologyConfiguration);
            _busEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
Esempio n. 4
0
        public ServiceBusBusConfiguration(IServiceBusTopologyConfiguration topologyConfiguration)
            : base(topologyConfiguration)
        {
            HostConfiguration        = new ServiceBusHostConfiguration(this, topologyConfiguration);
            BusEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
        public ActiveMqBusConfiguration(IActiveMqTopologyConfiguration topologyConfiguration)
            : base(topologyConfiguration)
        {
            HostConfiguration        = new ActiveMqHostConfiguration(this, topologyConfiguration);
            BusEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
        public AmazonSqsBusConfiguration(IAmazonSqsTopologyConfiguration topologyConfiguration)
            : base(topologyConfiguration)
        {
            HostConfiguration        = new AmazonSqsHostConfiguration(this, topologyConfiguration);
            BusEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
Esempio n. 7
0
        public HttpBusConfiguration(IHttpTopologyConfiguration topologyConfiguration)
            : base(topologyConfiguration)
        {
            HostConfiguration        = new HttpHostConfiguration(this, topologyConfiguration);
            BusEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
Esempio n. 8
0
        public RabbitMqBusConfiguration(IRabbitMqTopologyConfiguration topologyConfiguration)
            : base(topologyConfiguration)
        {
            _hostConfiguration        = new RabbitMqHostConfiguration(this, topologyConfiguration);
            _busEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
Esempio n. 9
0
        public ConfigurationBusBuilder(IBusConfiguration configuration, IReceiveEndpointConfiguration busReceiveEndpointConfiguration,
                                       BusObservable busObservable)
        {
            _busEndpointSpecification = new ConfigurationReceiveEndpointSpecification(busReceiveEndpointConfiguration);
            _configuration            = configuration;
            _busEndpointConfiguration = busReceiveEndpointConfiguration;

            _busObservable = busObservable;
        }
        protected BusFactoryConfigurator(IBusConfiguration configuration, IEndpointConfiguration busEndpointConfiguration)
        {
            _configuration            = configuration;
            _busEndpointConfiguration = busEndpointConfiguration;

            BusObservable           = new BusObservable();
            _specifications         = new List <IBusFactorySpecification>();
            _endpointSpecifications = new List <IReceiveEndpointSpecification <IBusBuilder> >();
        }
Esempio n. 11
0
        protected BusBuilder(IBusHostCollection hosts, IEndpointConfiguration configuration)
        {
            _hosts         = hosts;
            _configuration = configuration;

            _serializerBuilder = new SerializerBuilder();

            _busObservable = new BusObservable();

            _inputAddress = new Lazy <Uri>(GetInputAddress);

            _consumePipe = _configuration.Consume.CreatePipe();
        }
        public IBusControl Build()
        {
            try
            {
                _busEndpointConfigurator.Apply(this);

                return(new MassTransitBus(_busEndpointConfigurator.InputAddress, _busConsumePipe, SendEndpointProvider, PublishEndpoint, ReceiveEndpoints, _hosts, BusObservable));
            }
            catch (Exception exception)
            {
                TaskUtil.Await(() => BusObservable.CreateFaulted(exception));

                throw;
            }
        }
        public GrpcBusConfiguration(IGrpcTopologyConfiguration topologyConfiguration, Uri baseAddress)
            : base(topologyConfiguration)
        {
            HostConfiguration = new GrpcHostConfiguration(this, baseAddress, topologyConfiguration);

            Serialization.ClearDeserializers();
            Serialization.DefaultContentType = GrpcMessageSerializer.GrpcContentType;
            Serialization.AddDeserializer(GrpcMessageSerializer.GrpcContentType,
                                          () => new GrpcMessageDeserializer(GrpcMessageSerializer.Deserializer));
            Serialization.SetSerializer(() => new GrpcMessageSerializer());

            BusEndpointConfiguration = CreateEndpointConfiguration();

            _busObservers = new BusObservable();
        }
        public IBusControl Build()
        {
            try
            {
                IConsumePipe busConsumePipe = CreateBusReceiveEndpoint();

                return(new MassTransitBus(_inputAddress, busConsumePipe, SendEndpointProvider, PublishEndpoint, ReceiveEndpoints, _hosts, BusObservable));
            }
            catch (Exception exception)
            {
                TaskUtil.Await(() => BusObservable.CreateFaulted(exception));

                throw;
            }
        }
Esempio n. 15
0
        protected BusBuilder(IConsumePipeFactory consumePipeFactory, ISendPipeFactory sendPipeFactory,
            IPublishPipeFactory publishPipeFactory, IBusHostCollection hosts)
        {
            _consumePipeFactory = consumePipeFactory;
            _sendPipeFactory = sendPipeFactory;
            _publishPipeFactory = publishPipeFactory;
            _hosts = hosts;

            _serializerBuilder = new SerializerBuilder();

            _busObservable = new BusObservable();
            _sendTransportProvider = new Lazy<ISendTransportProvider>(CreateSendTransportProvider);

            _inputAddress = new Lazy<Uri>(GetInputAddress);
            _consumePipe = new Lazy<IConsumePipe>(GetConsumePipe);
        }
Esempio n. 16
0
        protected BusBuilder(IConsumePipeFactory consumePipeFactory, ISendPipeFactory sendPipeFactory,
                             IPublishPipeFactory publishPipeFactory, IBusHostCollection hosts)
        {
            _consumePipeFactory = consumePipeFactory;
            _sendPipeFactory    = sendPipeFactory;
            _publishPipeFactory = publishPipeFactory;
            _hosts = hosts;

            _serializerBuilder = new SerializerBuilder();

            _busObservable         = new BusObservable();
            _sendTransportProvider = new Lazy <ISendTransportProvider>(CreateSendTransportProvider);

            _inputAddress = new Lazy <Uri>(GetInputAddress);
            _consumePipe  = new Lazy <IConsumePipe>(GetConsumePipe);
        }
Esempio n. 17
0
        public IBusControl Build()
        {
            try
            {
                PreBuild();

                var bus = new MassTransitBus(InputAddress, ConsumePipe, SendEndpointProvider, PublishEndpointProvider, _hosts, BusObservable);

                TaskUtil.Await(() => _busObservable.PostCreate(bus));

                return(bus);
            }
            catch (Exception exception)
            {
                TaskUtil.Await(() => BusObservable.CreateFaulted(exception));

                throw;
            }
        }
Esempio n. 18
0
        protected BusBuilder(IConsumePipeSpecification consumePipeSpecification)
        {
            _consumePipeSpecification = consumePipeSpecification;
            _deserializerFactories = new Dictionary<string, DeserializerFactory>(StringComparer.OrdinalIgnoreCase);
            _receiveEndpoints = new List<IReceiveEndpoint>();
            _serializerFactory = () => new JsonMessageSerializer();
            _busObservable = new BusObservable();
            _serializer = new Lazy<IMessageSerializer>(CreateSerializer);
            _deserializer = new Lazy<IMessageDeserializer>(CreateDeserializer);
            _sendTransportProvider = new Lazy<ISendTransportProvider>(CreateSendTransportProvider);
            _sendEndpointProvider = new Lazy<ISendEndpointProvider>(CreateSendEndpointProvider);
            _publishSendEndpointProvider = new Lazy<IPublishEndpointProvider>(CreatePublishSendEndpointProvider);

            _inputAddress = new Lazy<Uri>(GetInputAddress);

            AddMessageDeserializer(JsonMessageSerializer.JsonContentType,
                (s, p) => new JsonMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(BsonMessageSerializer.BsonContentType,
                (s, p) => new BsonMessageDeserializer(BsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(XmlMessageSerializer.XmlContentType,
                (s, p) => new XmlMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
        }
Esempio n. 19
0
        protected BusBuilder(IConsumePipeSpecification consumePipeSpecification)
        {
            _consumePipeSpecification = consumePipeSpecification;
            _deserializerFactories    = new Dictionary <string, DeserializerFactory>(StringComparer.OrdinalIgnoreCase);
            _receiveEndpoints         = new List <IReceiveEndpoint>();
            _serializerFactory        = () => new JsonMessageSerializer();
            _busObservable            = new BusObservable();
            _serializer                  = new Lazy <IMessageSerializer>(CreateSerializer);
            _deserializer                = new Lazy <IMessageDeserializer>(CreateDeserializer);
            _sendTransportProvider       = new Lazy <ISendTransportProvider>(CreateSendTransportProvider);
            _sendEndpointProvider        = new Lazy <ISendEndpointProvider>(CreateSendEndpointProvider);
            _publishSendEndpointProvider = new Lazy <IPublishEndpointProvider>(CreatePublishSendEndpointProvider);

            _inputAddress = new Lazy <Uri>(GetInputAddress);

            AddMessageDeserializer(JsonMessageSerializer.JsonContentType,
                                   (s, p) => new JsonMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(BsonMessageSerializer.BsonContentType,
                                   (s, p) => new BsonMessageDeserializer(BsonMessageSerializer.Deserializer, s, p));
            AddMessageDeserializer(XmlMessageSerializer.XmlContentType,
                                   (s, p) => new XmlMessageDeserializer(JsonMessageSerializer.Deserializer, s, p));
        }
Esempio n. 20
0
 public ConnectHandle ConnectBusObserver(IBusObserver observer)
 {
     return(BusObservable.Connect(observer));
 }