public InMemoryReceiveEndpointBuilder(IBusBuilder busBuilder, InMemoryHost host, ISendTransportProvider sendTransportProvider, IInMemoryEndpointConfiguration configuration) : base(busBuilder, configuration) { _host = host; _sendTransportProvider = sendTransportProvider; _configuration = configuration; }
protected IReceivePipe CreateReceivePipe(IBusBuilder builder, Func <IConsumePipe, IReceiveEndpointBuilder> endpointBuilderFactory) { IConsumePipe consumePipe = _consumePipe ?? builder.CreateConsumePipe(_consumePipeConfigurator); IReceiveEndpointBuilder endpointBuilder = endpointBuilderFactory(consumePipe); foreach (IReceiveEndpointSpecification specification in _specifications) { specification.Configure(endpointBuilder); } ConfigureAddDeadLetterFilter(builder.SendTransportProvider); var publishEndpointProvider = builder.CreatePublishEndpointProvider(_publishPipeConfigurator); ConfigureRescueFilter(publishEndpointProvider, builder.SendTransportProvider); ISendEndpointProvider sendEndpointProvider = builder.CreateSendEndpointProvider(_sendPipeConfigurator); IMessageDeserializer messageDeserializer = builder.GetMessageDeserializer(sendEndpointProvider, publishEndpointProvider); _receiveConfigurator.UseFilter(new DeserializeFilter(messageDeserializer, consumePipe)); var receivePipe = _receiveConfigurator.Build(); return(new ReceivePipe(receivePipe, consumePipe)); }
public HttpReceiveEndpointBuilder(IBusBuilder busBuilder, IHttpHost host, BusHostCollection <HttpHost> hosts, IHttpEndpointConfiguration configuration) : base(busBuilder, configuration) { _host = host; _configuration = configuration; _hosts = hosts; }
private void ConfigureSubscriptions(IBusBuilder builder) { builder.SubscribeToEvent<ItemProduced>(ctx => { Console.WriteLine($"{ctx.Message.Quantity} of {ctx.Message.ItemId} produced."); return Task.CompletedTask; }); }
public ServiceBusSubscriptionEndpointBuilder(IBusBuilder busBuilder, IServiceBusHost host, IServiceBusEndpointConfiguration configuration, ISendTransportProvider sendTransportProvider) : base(busBuilder, configuration) { _configuration = configuration; _host = host; _sendTransportProvider = sendTransportProvider; }
public RabbitMqReceiveEndpointBuilder(IConsumePipe consumePipe, IBusBuilder busBuilder, bool bindMessageExchanges, IRabbitMqHost host) : base(consumePipe, busBuilder) { _bindMessageExchanges = bindMessageExchanges; _host = host; _exchangeBindings = new List <ExchangeBindingSettings>(); }
protected ReceiveEndpointBuilder(IBusBuilder builder, IEndpointConfiguration configuration) { _configuration = configuration; _consumePipe = configuration.Consume.CreatePipe(); _serializerBuilder = builder.CreateSerializerBuilder(); }
public ServiceBusReceiveEndpointBuilder(IConsumePipe consumePipe, IBusBuilder busBuilder, bool subscribeMessageTopics, IServiceBusHost host) : base(consumePipe, busBuilder) { _subscribeMessageTopics = subscribeMessageTopics; _host = host; _topicSubscriptions = new List <TopicSubscriptionSettings>(); }
public ServiceBusReceiveEndpointBuilder(IBusBuilder busBuilder, IServiceBusHost host, bool subscribeMessageTopics, IServiceBusEndpointConfiguration configuration, ISendTransportProvider sendTransportProvider) : base(busBuilder, configuration) { _subscribeMessageTopics = subscribeMessageTopics; _configuration = configuration; _sendTransportProvider = sendTransportProvider; _host = host; }
public RabbitMqReceiveEndpointBuilder(IBusBuilder busBuilder, IRabbitMqHost host, BusHostCollection <RabbitMqHost> hosts, bool bindMessageExchanges, IRabbitMqEndpointConfiguration configuration) : base(busBuilder, configuration) { _bindMessageExchanges = bindMessageExchanges; _configuration = configuration; _host = host; _hosts = hosts; }
public override void Apply(IBusBuilder builder) { var receiveEndpointBuilder = new ServiceBusReceiveEndpointBuilder(CreateConsumePipe(builder), builder, _subscribeMessageTopics, Host); var receivePipe = CreateReceivePipe(receiveEndpointBuilder); ApplyReceiveEndpoint(receiveEndpointBuilder, receivePipe, new PrepareReceiveEndpointFilter(_settings, receiveEndpointBuilder.GetTopicSubscriptions().Distinct().ToArray()), new PrepareQueueClientFilter(_settings)); }
public override void Apply(IBusBuilder builder) { var receiveEndpointBuilder = new ServiceBusReceiveEndpointBuilder(CreateConsumePipe(builder), builder, false, Host); var receivePipe = CreateReceivePipe(receiveEndpointBuilder); ApplyReceiveEndpoint(receiveEndpointBuilder, receivePipe, new PrepareSubscriptionEndpointFilter(_settings), new PrepareSubscriptionClientFilter(_settings)); }
protected void ApplySpecifications(IBusBuilder builder) { foreach (IBusFactorySpecification configurator in _specifications) { configurator.Apply(builder); } foreach (IReceiveEndpointSpecification <IBusBuilder> configurator in _endpointSpecifications) { configurator.Apply(builder); } }
public static IObservable <EventContext <TEvent> > ObserveEvent <TEvent>(this IBusBuilder builder) where TEvent : class, IEvent { ISubject <EventContext <TEvent> > subject = new Subject <EventContext <TEvent> >(); builder.SubscribeToEvent <TEvent>(msg => { subject.OnNext(msg); return(Task.CompletedTask); }); return(subject); }
public override void Apply(IBusBuilder builder) { var receiveEndpointBuilder = new ServiceBusSubscriptionEndpointBuilder(builder, Host, _configuration, _sendTransportProvider); var receivePipe = CreateReceivePipe(receiveEndpointBuilder); var receiveEndpointTopology = receiveEndpointBuilder.CreateReceiveEndpointTopology(InputAddress, _settings); ApplyReceiveEndpoint(receivePipe, receiveEndpointTopology, x => { x.UseFilter(new ConfigureTopologyFilter <SubscriptionSettings>(_settings, receiveEndpointTopology.BrokerTopology, false)); x.UseFilter(new PrepareSubscriptionClientFilter(_settings)); }); }
public void Apply(IBusBuilder builder) { RabbitMqReceiveEndpointBuilder endpointBuilder = null; var receivePipe = CreateReceivePipe(builder, consumePipe => { endpointBuilder = new RabbitMqReceiveEndpointBuilder(consumePipe, _host.MessageNameFormatter); return endpointBuilder; }); if (endpointBuilder == null) throw new InvalidOperationException("The endpoint builder was not initialized"); var transport = new RabbitMqReceiveTransport(_host.ConnectionCache, _settings, endpointBuilder.GetExchangeBindings().ToArray()); builder.AddReceiveEndpoint(new ReceiveEndpoint(transport, receivePipe)); }
public void Apply(IBusBuilder builder) { ServiceBusReceiveEndpointBuilder endpointBuilder = null; var receivePipe = CreateReceivePipe(builder, consumePipe => { endpointBuilder = new ServiceBusReceiveEndpointBuilder(consumePipe, _host.MessageNameFormatter); return endpointBuilder; }); if (endpointBuilder == null) throw new InvalidOperationException("The endpoint builder was not initialized"); var transport = new ServiceBusReceiveTransport(_host, _settings, endpointBuilder.GetTopicSubscriptions().ToArray()); builder.AddReceiveEndpoint(_settings.QueueDescription.Path, new ReceiveEndpoint(transport, receivePipe)); }
/// <inheritdoc/> public void Apply(IBusBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (this.encryptionKey != null) { builder.SetMessageSerializer(this.GetMessageSerializer); } if (this.keyResolver != null) { builder.AddMessageDeserializer(EncryptedMessageSerializer.EncryptedContentType, this.GetMessageDeserializer); } }
public void Apply(IBusBuilder builder) { ServiceBusReceiveEndpointBuilder endpointBuilder = null; IPipe <ReceiveContext> receivePipe = CreateReceivePipe(builder, consumePipe => { endpointBuilder = new ServiceBusReceiveEndpointBuilder(consumePipe, _host.MessageNameFormatter); return(endpointBuilder); }); if (endpointBuilder == null) { throw new InvalidOperationException("The endpoint builder was not initialized"); } var transport = new ServiceBusReceiveTransport(_host, _settings, endpointBuilder.GetTopicSubscriptions().ToArray()); builder.AddReceiveEndpoint(new ReceiveEndpoint(transport, receivePipe)); }
public void Apply(IBusBuilder builder) { RabbitMqReceiveEndpointBuilder endpointBuilder = null; var receivePipe = CreateReceivePipe(builder, consumePipe => { endpointBuilder = new RabbitMqReceiveEndpointBuilder(consumePipe, _host.MessageNameFormatter); return(endpointBuilder); }); if (endpointBuilder == null) { throw new InvalidOperationException("The endpoint builder was not initialized"); } var transport = new RabbitMqReceiveTransport(_host, _settings, endpointBuilder.GetExchangeBindings().ToArray()); builder.AddReceiveEndpoint(_settings.QueueName ?? NewId.Next().ToString(), new ReceiveEndpoint(transport, receivePipe)); }
protected IPipe <ReceiveContext> CreateReceivePipe(IBusBuilder builder, Func <IConsumePipe, IReceiveEndpointBuilder> endpointBuilderFactory) { IConsumePipe consumePipe = _consumePipe ?? builder.CreateConsumePipe(_consumePipeSpecification); IReceiveEndpointBuilder endpointBuilder = endpointBuilderFactory(consumePipe); foreach (IReceiveEndpointSpecification specification in _specifications) { specification.Configure(endpointBuilder); } ConfigureAddDeadLetterFilter(builder.SendTransportProvider); ConfigureRescueFilter(builder.SendTransportProvider); _receiveConfigurator.UseFilter(new DeserializeFilter(builder.MessageDeserializer, consumePipe)); return(_receiveConfigurator.Build()); }
public void Apply(IBusBuilder builder) { var receiveEndpointBuilder = new HttpReceiveEndpointBuilder(_host, CreateConsumePipe(builder), builder); var receivePipe = CreateReceivePipe(receiveEndpointBuilder); _sendEndpointProvider = CreateSendEndpointProvider(receiveEndpointBuilder); _publishEndpointProvider = CreatePublishEndpointProvider(receiveEndpointBuilder); var sendPipe = builder.CreateSendPipe(); var receiveSettings = new Settings(_pathMatch, receiveEndpointBuilder.MessageSerializer, _sendEndpointProvider, _publishEndpointProvider); var transport = new HttpReceiveTransport(_host, receiveSettings, sendPipe); var httpHost = _host as HttpHost; if (httpHost == null) throw new ConfigurationException("Must be a HttpHost"); httpHost.ReceiveEndpoints.Add(NewId.Next().ToString(), new ReceiveEndpoint(transport, receivePipe)); }
public IBusBuilder Configure(IBusBuilder builder) { if (builder == null) { throw new ArgumentNullException("builder"); } builder.Match <IServiceBusBuilder>(x => { var settings = new ServiceBusSettings(builder.Settings); settings.InputAddress = _uri ?? builder.Settings.InputAddress.AppendToPath("_control"); // the endpoint factory is already created, so we can't set the endpoint here // we really need this to be part of another step, but i don't have a clue how yet. //_configurator.ConfigureEndpoint(_uri, x => x.PurgeExistingMessages()); if (_log.IsDebugEnabled) { _log.DebugFormat("Configuring control bus for {0} at {1}", builder.Settings.InputAddress, settings.InputAddress); } settings.ConcurrentConsumerLimit = 1; settings.ConcurrentReceiverLimit = 1; settings.AutoStart = true; IBusBuilder controlBusBuilder = new ControlBusBuilder(settings); controlBusBuilder = _configurators .Aggregate(controlBusBuilder, (current, configurator) => configurator.Configure(current)); IControlBus controlBus = controlBusBuilder.Build(); x.UseControlBus(controlBus); }); return(builder); }
public IServiceBus CreateServiceBus() { LogAssemblyVersionInformation(); IEndpointCache endpointCache = CreateEndpointCache(); _settings.EndpointCache = endpointCache; IBusBuilder builder = _builderFactory(_settings); _subscriptionRouterConfigurator.SetNetwork(_settings.Network); // run through all configurators that have been set and let // them do their magic foreach (IBusBuilderConfigurator configurator in _configurators) { builder = configurator.Configure(builder); } IServiceBus bus = builder.Build(); return(bus); }
public void Apply(IBusBuilder builder) { var receiveEndpointBuilder = new HttpReceiveEndpointBuilder(builder, _host, _hosts, _configuration); var receiveEndpointTopology = receiveEndpointBuilder.CreateReceiveEndpointTopology(InputAddress); var receivePipe = CreateReceivePipe(receiveEndpointBuilder); _sendEndpointProvider = receiveEndpointTopology.SendEndpointProvider; _publishEndpointProvider = receiveEndpointTopology.PublishEndpointProvider; var receiveSettings = new Settings(_pathMatch); var transport = new HttpReceiveTransport(_host, receiveSettings, receiveEndpointTopology); var httpHost = _host as HttpHost; if (httpHost == null) { throw new ConfigurationException("Must be a HttpHost"); } httpHost.ReceiveEndpoints.Add(NewId.Next().ToString(), new ReceiveEndpoint(transport, receivePipe)); }
public void Apply(IBusBuilder builder) { var receiveEndpointBuilder = new HttpReceiveEndpointBuilder(_host, CreateConsumePipe(builder), builder); var receivePipe = CreateReceivePipe(receiveEndpointBuilder); _sendEndpointProvider = CreateSendEndpointProvider(receiveEndpointBuilder); _publishEndpointProvider = CreatePublishEndpointProvider(receiveEndpointBuilder); var sendPipe = builder.CreateSendPipe(); var receiveSettings = new Settings(_pathMatch, receiveEndpointBuilder.MessageSerializer, _sendEndpointProvider, _publishEndpointProvider); var transport = new HttpReceiveTransport(_host, receiveSettings, sendPipe); var httpHost = _host as HttpHost; if (httpHost == null) { throw new ConfigurationException("Must be a HttpHost"); } httpHost.ReceiveEndpoints.Add(NewId.Next().ToString(), new ReceiveEndpoint(transport, receivePipe)); }
private void ConfigureSubscriptions(IBusBuilder builder) { builder.SubscribeToCommand<ReverseString>(); }
public void Apply(IBusBuilder builder) { builder.SetMessageSerializer(() => new TSerializer()); }
protected IConsumePipe CreateConsumePipe(IBusBuilder builder) { return(_consumePipe ?? builder.CreateConsumePipe(_consumePipeSpecification)); }
public void Apply(IBusBuilder builder) { builder.AddMessageDeserializer(_contentType, _deserializerFactory); }
private void ConfigureSubscriptions(IBusBuilder builder) { builder.SubscribeToEvent<StringReversed>(); }
public void Apply(IBusBuilder builder) { var observer = new InMemorySchedulerBusObserver(_scheduler); builder.ConnectBusObserver(observer); }
private void ConfigureSubscriptions(IBusBuilder builder) { builder.SubscribeToCommand<ProduceItem>(); }
public void Apply(IBusBuilder builder) { builder.SetMessageSerializer(CreateSerializer); builder.AddMessageDeserializer(EncryptedMessageSerializer.EncryptedContentType, CreateDeserializer); }
public void Apply(IBusBuilder builder) { var observer = _observerFactory(); builder.ConnectBusObserver(observer); }
public IBusBuilder Configure(IBusBuilder builder) { builder.AddBusServiceConfigurator(_configurator); return(builder); }
public HttpReceiveEndpointBuilder(IHttpHost host, IConsumePipe consumePipe, IBusBuilder busBuilder) : base(consumePipe, busBuilder) { _host = host; }
protected Configure() { Container = new StandardContainer(); _busConfigurer = new BusBuilder(); _busBuilder = _busConfigurer as IBusBuilder; }
public void Apply(IBusBuilder builder) { var observer = new SchedulerBusObserver(_scheduler, _schedulerEndpointAddress); builder.ConnectBusObserver(observer); }
public void Apply(IBusBuilder builder) { }
public void Apply(IBusBuilder builder) { var observer = new PerformanceCounterBusObserver(_factory); builder.ConnectBusObserver(observer); }
public InMemoryReceiveEndpointBuilder(IConsumePipe consumePipe, IBusBuilder busBuilder) : base(consumePipe, busBuilder) { }