protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { Handler <PingMessage>(configurator, context => { throw new SerializationException("This is fine, forcing death"); }); }
/// <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 ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { configurator.UseDelayedRedelivery(r => r.Interval(1, TimeSpan.FromMilliseconds(100))); configurator.UseRetry(r => r.Interval(1, TimeSpan.FromMilliseconds(100))); configurator.UseInMemoryOutbox(); configurator.Consumer <TestHandler>(); }
protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { configurator.ConfigureConsumeTopology = false; configurator.Subscribe("private-topic", s => { }); _handler = Handled <PrivateMessage>(configurator); }
protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { _first = Handler <FirstMessage>(configurator, async context => { await context.SchedulePublish(DateTime.Now, new SecondMessage()); await context.ReceiveContext.ReceiveCompleted; }); _second = Handled <SecondMessage>(configurator); }
protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { _first = Handler <FirstMessage>(configurator, async context => { await context.ScheduleSend(TimeSpan.FromSeconds(5), new SecondMessage()); await context.ReceiveContext.ReceiveCompleted; }); _second = Handled <SecondMessage>(configurator); }
/// <summary> /// We may want to have a builder/endpoint context that could store things like management endpoint, etc. to configure /// filters and add configuration interfaces for things like concurrency limit and prefetch count /// </summary> /// <param name="configurator"></param> /// <param name="definition"></param> /// <param name="configure">The callback to invoke after the definition configuration has been applied</param> internal static void Apply(this IAmazonSqsReceiveEndpointConfigurator configurator, IEndpointDefinition definition, Action <IAmazonSqsReceiveEndpointConfigurator> configure = null) { if (definition.IsTemporary) { configurator.AutoDelete = true; configurator.Durable = false; } if (definition.PrefetchCount.HasValue) { configurator.PrefetchCount = (ushort)definition.PrefetchCount.Value; } if (definition.ConcurrentMessageLimit.HasValue) { var concurrentMessageLimit = definition.ConcurrentMessageLimit.Value; // if there is a prefetchCount, and it's greater than the concurrent message limit, we need a filter if (!definition.PrefetchCount.HasValue || definition.PrefetchCount.Value > concurrentMessageLimit) { configurator.UseConcurrencyLimit(concurrentMessageLimit); // we should determine a good value to use based upon the concurrent message limit if (definition.PrefetchCount.HasValue == false) { var calculatedPrefetchCount = concurrentMessageLimit * 12 / 10; configurator.PrefetchCount = (ushort)calculatedPrefetchCount; } } } definition.Configure(configurator); configure?.Invoke(configurator); }
protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { base.ConfigureAmazonSqsReceiveEndpoint(configurator); _handled = Handled <Ping>(configurator); }
protected virtual void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { }
protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { configurator.Consumer <Consumer>(); }
protected override void ConfigureAmazonSqsReceiveEndpoint(IAmazonSqsReceiveEndpointConfigurator configurator) { _handled = Handled <Command>(configurator); }