protected override void ConfigureAmazonSqsBus(IAmazonSqsBusFactoryConfigurator configurator) { configurator.ReceiveEndpoint("input-fault", endpointConfigurator => { _faulted = Handled <Fault <TestCommand> >(endpointConfigurator); }); }
/// <summary> /// Registers a management endpoint on the bus, which can be used to control /// filters and other management control points on the bus. /// </summary> /// <param name="configurator"></param> /// <param name="host">The host where the endpoint is to be created</param> /// <param name="configure">Configure additional values of the underlying receive endpoint</param> /// <returns></returns> public static IManagementEndpointConfigurator ManagementEndpoint(this IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host, Action <IAmazonSqsReceiveEndpointConfigurator> configure = null) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (host == null) { throw new ArgumentNullException(nameof(host)); } var queueName = host.Topology.CreateTemporaryQueueName("manage-"); IAmazonSqsReceiveEndpointConfigurator specification = null; configurator.ReceiveEndpoint(host, queueName, x => { x.AutoDelete = true; x.Durable = false; configure?.Invoke(x); specification = x; }); var managementEndpointConfigurator = new ManagementEndpointConfigurator(specification); return(managementEndpointConfigurator); }
protected override void ConfigureAmazonSqsBusHost(IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host) { configurator.ReceiveEndpoint(host, "input_queue_error", x => { x.SubscribeMessageTopics = false; _errorHandler = Handled <PingMessage>(x); }); }
protected override void ConfigureAmazonSqsBusHost(IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host) { configurator.ReceiveEndpoint(host, "input_queue_error", x => { x.ConfigureConsumeTopology = false; x.PurgeOnStartup = true; _errorHandler = Handled <PingMessage>(x); }); }
/// <summary> /// Declare a ReceiveEndpoint using a unique generated queue name. This queue defaults to auto-delete /// and non-durable. By default all services bus instances include a default receiveEndpoint that is /// of this type (created automatically upon the first receiver binding). /// </summary> /// <param name="configurator"></param> /// <param name="host"></param> /// <param name="configure"></param> public static void ReceiveEndpoint(this IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host, Action <IAmazonSqsReceiveEndpointConfigurator> configure) { var queueName = host.Topology.CreateTemporaryQueueName("receiveEndpoint-"); configurator.ReceiveEndpoint(host, queueName, x => { x.AutoDelete = true; x.Durable = false; configure(x); }); }
/// <summary> /// Configure a AmazonSQS host using the configuration API /// </summary> /// <param name="configurator"></param> /// <param name="hostAddress">The URI host address of the AmazonSQS host (amazonsqs://region)</param> /// <param name="configure"></param> public static IAmazonSqsHost Host(this IAmazonSqsBusFactoryConfigurator configurator, Uri hostAddress, Action <IAmazonSqsHostConfigurator> configure) { if (hostAddress == null) { throw new ArgumentNullException(nameof(hostAddress)); } var hostConfigurator = new AmazonSqsHostConfigurator(hostAddress); configure(hostConfigurator); return(configurator.Host(hostConfigurator.Settings)); }
static void ConfigureHost(IAmazonSqsBusFactoryConfigurator cfg) { cfg.Host(new Uri("amazonsqs://localhost:4576"), h => { h.AccessKey("admin"); h.SecretKey("admin"); h.Config(new AmazonSQSConfig { ServiceURL = "http://localhost:4566" }); h.Config(new AmazonSimpleNotificationServiceConfig { ServiceURL = "http://localhost:4566" }); }); }
protected virtual void ConfigureAmazonSqsBusHost(IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host) { }
protected virtual void ConfigureAmazonSqsBus(IAmazonSqsBusFactoryConfigurator configurator) { }
/// <summary> /// Declare a ReceiveEndpoint using a unique generated queue name. This queue defaults to auto-delete /// and non-durable. By default all services bus instances include a default receiveEndpoint that is /// of this type (created automatically upon the first receiver binding). /// </summary> /// <param name="configurator"></param> /// <param name="definition"></param> /// <param name="configure"></param> public static void ReceiveEndpoint(this IAmazonSqsBusFactoryConfigurator configurator, IEndpointDefinition definition, Action <IAmazonSqsReceiveEndpointConfigurator> configure = null) { configurator.ReceiveEndpoint(definition, DefaultEndpointNameFormatter.Instance, configure); }
public static void ReceiveEndpoint(this IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host, Action <IAmazonSqsReceiveEndpointConfigurator> configure = null) { configurator.ReceiveEndpoint(new TemporaryEndpointDefinition(), DefaultEndpointNameFormatter.Instance, configure); }
/// <summary> /// Configure a AmazonSQS host with a host name and virtual host /// </summary> /// <param name="configurator"></param> /// <param name="hostName">The host name of the broker</param> /// <param name="configure">The configuration callback</param> public static IAmazonSqsHost Host(this IAmazonSqsBusFactoryConfigurator configurator, string hostName, Action <IAmazonSqsHostConfigurator> configure) { return(configurator.Host(new UriBuilder("amazonsqs", hostName).Uri, configure)); }
protected override void ConfigureAmazonSqsBus(IAmazonSqsBusFactoryConfigurator configurator) { configurator.UseAmazonSqsMessageScheduler(); }
protected override void ConfigureAmazonSqsBusHost(IAmazonSqsBusFactoryConfigurator configurator, IAmazonSqsHost host) { base.ConfigureAmazonSqsBusHost(configurator, host); configurator.UseAmazonSqsMessageScheduler(); }
/// <summary> /// Configure recieve endpoint for Fifo queues. /// </summary> /// <param name="busRegistrationContext">Bus registration context</param> /// <param name="busFactoryConfigurator">Bus configuration context</param> /// <param name="endpointConsumer">Endpoint configuration context</param> /// <param name="amazonMqOptions">Force connection params</param> /// <param name="createSeparateQueue">Create separate Queue for consumer. It is allow to process same type messages with different consumers. It is publish-consumer pattern.</param> /// <exception cref="ArgumentNullException"/> /// <exception cref="ConfigurationException"/> public static void RegisterReceiveEndpointAsFifo <T, TMessage>(this IBusRegistrationContext busRegistrationContext, IAmazonSqsBusFactoryConfigurator busFactoryConfigurator, Action <IEndpointConfigurator>?endpointConsumer = null, AmazonMqOptions?amazonMqOptions = null, bool createSeparateQueue = false) where T : class, IConsumer <TMessage> where TMessage : class { if (busRegistrationContext == null) { throw new ArgumentNullException(nameof(busRegistrationContext)); } if (busFactoryConfigurator == null) { throw new ArgumentNullException(nameof(busFactoryConfigurator)); } RegisterConsumersEndpoint <TMessage>(busRegistrationContext, busFactoryConfigurator, configurator => { configurator.ConfigureConsumeTopology = false; configurator.QueueAttributes.Add(QueueAttributeName.FifoQueue, true); endpointConsumer?.Invoke(configurator); }, new[] { typeof(T) }, amazonMqOptions, createSeparateQueue); }
/// <summary> /// Register receive EndPoint and bind with type <typeparamref name="T"/>. /// </summary> /// <param name="busRegistrationContext">Bus registration contex.</param> /// <param name="busFactoryConfigurator">Configuration factory.</param> /// <param name="endpointConsumerConfigurator">Configure consumer delegate.</param> /// <param name="amazonMqOptions">Force connection params</param> /// <param name="createSeparateQueue">True for Publish, false when only Send.</param> /// <typeparam name="T">Consumer type.</typeparam> /// <typeparam name="TMessage">Consumer message type.</typeparam> /// <exception cref="ArgumentNullException"/> public static void RegisterReceiveEndpoint <T, TMessage>(this IBusRegistrationContext busRegistrationContext, IAmazonSqsBusFactoryConfigurator busFactoryConfigurator, Action <IEndpointConfigurator>?endpointConsumerConfigurator = null, AmazonMqOptions?amazonMqOptions = null, bool createSeparateQueue = false) where T : class, IConsumer <TMessage> where TMessage : class, IConsumer { if (busRegistrationContext == null) { throw new ArgumentNullException(nameof(busRegistrationContext)); } if (busFactoryConfigurator == null) { throw new ArgumentNullException(nameof(busFactoryConfigurator)); } RegisterConsumersEndpoint <TMessage>(busRegistrationContext, busFactoryConfigurator, endpointConsumerConfigurator, new[] { typeof(T) }, amazonMqOptions, createSeparateQueue); }
protected override void ConfigureAmazonSqsBus(IAmazonSqsBusFactoryConfigurator configurator) { configurator.UseRawJsonSerializer(); }