public static Source <CommittableIncomingMessage, Akka.NotUsed> CommittableQueue(Action <SimpleQueueOptions> opt) { var option = new SimpleQueueOptions(); opt.Invoke(option); var connectionSettings = AmqpConnectionDetails.Create(option.HostAndPorts.First().Host, option.HostAndPorts.First().Port) .WithHostsAndPorts(option.HostAndPorts.First(), option.HostAndPorts.ToArray()) .WithCredentials(AmqpCredentials.Create(option.UserName, option.Password)) .WithAutomaticRecoveryEnabled(true) .WithNetworkRecoveryInterval(TimeSpan.FromSeconds(1)) .WithVirtualHost(option.VirtualHost); var queueDeclaration = QueueDeclaration.Create(option.QueueName) .WithDurable(false) .WithAutoDelete(false); return(AmqpSource.CommittableSource(NamedQueueSourceSettings.Create(connectionSettings, option.QueueName) .WithDeclarations(queueDeclaration), 1)); }
public static Sink <ByteString, Task> Simple(Action <SimpleQueueOptions> opt) { var option = new SimpleQueueOptions(); opt.Invoke(option); var connectionSettings = AmqpConnectionDetails.Create(option.HostAndPorts.First().Host, option.HostAndPorts.First().Port) .WithHostsAndPorts(option.HostAndPorts.First(), option.HostAndPorts.ToArray()) .WithCredentials(AmqpCredentials.Create(option.UserName, option.Password)) .WithAutomaticRecoveryEnabled(true) .WithNetworkRecoveryInterval(TimeSpan.FromSeconds(1)) .WithVirtualHost(option.VirtualHost ?? "/"); var queueDeclaration = QueueDeclaration.Create(option.QueueName) .WithDurable(false) .WithAutoDelete(false); return(AmqpSink.CreateSimple(AmqpSinkSettings.Create(connectionSettings) .WithRoutingKey(option.QueueName) .WithDeclarations(queueDeclaration))); }