public static IBrokeredMessageReceiver CreateBrokeredMessageReceiver(this IBusFactorySelector selector, IBinder binder, Action <IWebJobReceiverConfigurator> configure) { if (binder == null) { throw new ArgumentNullException(nameof(binder)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var topologyConfiguration = new ServiceBusTopologyConfiguration(AzureBusFactory.MessageTopology); var busConfiguration = new ServiceBusBusConfiguration(topologyConfiguration); ServiceBusHostConfigurator hostConfigurator = new ServiceBusHostConfigurator(new Uri("sb://no-host-configured/")); var hostConfiguration = busConfiguration.CreateHostConfiguration(hostConfigurator.Settings); var endpointConfiguration = new BrokeredMessageReceiverServiceBusEndpointConfiguration(hostConfiguration, busConfiguration); var configurator = new WebJobBrokeredMessageReceiverSpecification(binder, endpointConfiguration); configure(configurator); return(configurator.Build()); }
public static IEventDataReceiver CreateEventDataReceiver(this IBusFactorySelector selector, IBinder binder, Action <IWebJobReceiverConfigurator> configure) { if (binder == null) { throw new ArgumentNullException(nameof(binder)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var endpointConfiguration = new ServiceBusEndpointConfiguration(new ServiceBusTopologyConfiguration(AzureBusFactory.MessageTopology)); var topologyConfiguration = new ServiceBusTopologyConfiguration(AzureBusFactory.MessageTopology); var busConfiguration = new ServiceBusBusConfiguration(topologyConfiguration); var busEndpointConfiguration = busConfiguration.CreateReceiveEndpointConfiguration(new Uri("sb://localhost/"), new Uri("sb://localhost/")); var configurator = new WebJobEventDataReceiverSpecification(binder, busEndpointConfiguration); configure(configurator); return(configurator.Build()); }
/// <summary> /// Create a mediator, which sends messages to consumers, handlers, and sagas. Messages are dispatched to the consumers asynchronously. /// Consumers are not directly coupled to the sender. Can be used entirely in-memory without a broker. /// </summary> /// <param name="selector"></param> /// <param name="configure"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static IMediator CreateMediator(this IBusFactorySelector selector, Action <IMediatorConfigurator> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var topologyConfiguration = new InMemoryTopologyConfiguration(InMemoryBus.MessageTopology); var busConfiguration = new InMemoryBusConfiguration(topologyConfiguration, new Uri("loopback://localhost")); var endpointConfiguration = busConfiguration.HostConfiguration.CreateReceiveEndpointConfiguration("mediator"); var configurator = new MediatorConfiguration(busConfiguration.HostConfiguration, endpointConfiguration); configure(configurator); var mediatorDispatcher = configurator.Build(); var responseEndpointConfiguration = busConfiguration.HostConfiguration.CreateReceiveEndpointConfiguration("response"); var responseConfigurator = new ReceivePipeDispatcherConfiguration(busConfiguration.HostConfiguration, responseEndpointConfiguration); configurator = new MediatorConfiguration(busConfiguration.HostConfiguration, responseEndpointConfiguration); configure(configurator); var responseDispatcher = responseConfigurator.Build(); return(new MassTransitMediator(LogContext.Current, endpointConfiguration, mediatorDispatcher, responseEndpointConfiguration, responseDispatcher)); }
public static IEventDataReceiver CreateEventDataReceiver(this IBusFactorySelector selector, IBinder binder, Action <IWebJobReceiverConfigurator> configure) { if (binder == null) { throw new ArgumentNullException(nameof(binder)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var topologyConfiguration = new ServiceBusTopologyConfiguration(AzureBusFactory.MessageTopology); var busConfiguration = new ServiceBusBusConfiguration(topologyConfiguration); var queueConfigurator = new QueueConfigurator("no-host-configured") { AutoDeleteOnIdle = Defaults.TemporaryAutoDeleteOnIdle, }; var settings = new ReceiveEndpointSettings("no-host-configured", queueConfigurator); var busEndpointConfiguration = busConfiguration.CreateReceiveEndpointConfiguration(settings, busConfiguration); var configurator = new WebJobEventDataReceiverSpecification(binder, busEndpointConfiguration); configure(configurator); return(configurator.Build()); }
public static IServiceBus CreateMassInstanceRabbitMqBus( this IBusFactorySelector busFactorySelector, IMassInstanceConsumerFactory consumerFactory, Action <IMassInstanceBusFactoryConfigurator> configure) { return(MassInstanceBusFactory.Create( configure, consumerFactory)); }
//bus.ConnectPublishObserver(observer); // bus.ConnectSendObserver(observer); public static IBusControl CreateUsingSimpleRabbitMqConfiguration(this IBusFactorySelector bus, string connectionString, string userName, string password, Action <IRabbitMqBusFactoryConfigurator, IRabbitMqHost> configCallback = null) { return(bus.CreateUsingRabbitMq(config => { var host = config.Host(new Uri(connectionString), h => { h.Username(userName); h.Password(password); }); config.UseJsonSerializer(); if (configCallback != null) { configCallback(config, host); } })); }
public static IBrokeredMessageReceiver CreateBrokeredMessageReceiver(this IBusFactorySelector selector, IBinder binder, ILogger logger, Action <IWebJobReceiverConfigurator> configure) { return(CreateBrokeredMessageReceiver(binder, logger, CancellationToken.None, configure)); }
/// <summary> /// Configure and create an in-memory bus /// </summary> /// <param name="selector">Hang off the selector interface for visibility</param> /// <param name="configure">The configuration callback to configure the bus</param> /// <returns></returns> public static IBusControl CreateUsingInMemory(this IBusFactorySelector selector, Action <IInMemoryBusFactoryConfigurator> configure) { return(InMemoryBus.Create(configure)); }
/// <summary> /// Select AmazonSQS as the transport for the service bus /// </summary> public static IBusControl CreateUsingAmazonSqs(this IBusFactorySelector selector, Action <IAmazonSqsBusFactoryConfigurator> configure) { return(AmazonSqsBusFactory.Create(configure)); }
/// <summary> /// Select RabbitMQ as the transport for the service bus /// </summary> public static IBusControl CreateUsingRabbitMq(this IBusFactorySelector selector, Action <IRabbitMqBusFactoryConfigurator> configure) { return(RabbitMqBusFactory.Create(configure)); }
/// <summary> /// Configure and create a bus for Azure Service Bus /// </summary> /// <param name="selector">Hang off the selector interface for visibility</param> /// <param name="configure">The configuration callback to configure the bus</param> /// <returns></returns> public static IBusControl CreateUsingAzureServiceBus(this IBusFactorySelector selector, Action <IServiceBusBusFactoryConfigurator> configure) { return(AzureBusFactory.CreateUsingServiceBus(configure)); }
public static IEventDataReceiver CreateEventDataReceiver(this IBusFactorySelector selector, IBinder binder, ILogger logger, Action <IReceiverConfigurator> configure) { return(CreateEventDataReceiver(binder, logger, CancellationToken.None, configure)); }
public static IBusControl CreateUsingRabitMqOnLocalhost(this IBusFactorySelector bus, string userName, string password, Action <IRabbitMqBusFactoryConfigurator, IRabbitMqHost> configCallback = null) { return(bus.CreateUsingSimpleRabbitMqConfiguration("rabbitmq://localhost", userName, password, configCallback)); }
/// <summary> /// Configure and create a gRPC bus /// </summary> /// <param name="selector">Hang off the selector interface for visibility</param> /// <param name="baseAddress">Override the default base address</param> /// <param name="configure">The configuration callback to configure the bus</param> /// <returns></returns> public static IBusControl CreateUsingGrpc(this IBusFactorySelector selector, Uri baseAddress, Action <IGrpcBusFactoryConfigurator> configure) { return(GrpcBus.Create(baseAddress, configure)); }
public static IBusControl CreateUsingHttp(this IBusFactorySelector selector, Action <IHttpBusFactoryConfigurator> configure) { return(HttpBusFactory.Create(configure)); }
/// <summary> /// Select RabbitMQ as the transport for the service bus /// </summary> public static IBusControl CreateUsingActiveMq(this IBusFactorySelector selector, Action<IActiveMqBusFactoryConfigurator> configure) { return ActiveMqBusFactory.Create(configure); }