public async Task SetUp() { receivedMessages = new BlockingCollection <IncomingMessage>(); var connectionString = Environment.GetEnvironmentVariable("RabbitMQTransport_ConnectionString") ?? "host=localhost"; var useTls = connectionString.StartsWith("https", StringComparison.InvariantCultureIgnoreCase) || connectionString.StartsWith("amqps", StringComparison.InvariantCultureIgnoreCase); var transport = new RabbitMQTransport(RoutingTopology.Conventional(QueueType.Classic), connectionString); var connectionConfig = transport.ConnectionConfiguration; connectionFactory = new ConnectionFactory(ReceiverQueue, connectionConfig, null, true, false, transport.HeartbeatInterval, transport.NetworkRecoveryInterval, null); infra = await transport.Initialize(new HostSettings(ReceiverQueue, ReceiverQueue, new StartupDiagnosticEntries(), (_, __, ___) => { }, true), new[] { new ReceiveSettings(ReceiverQueue, new QueueAddress(ReceiverQueue), true, true, "error") }, AdditionalReceiverQueues.Concat(new[] { ErrorQueue }).ToArray()); messageDispatcher = infra.Dispatcher; messagePump = infra.Receivers[ReceiverQueue]; subscriptionManager = messagePump.Subscriptions; await messagePump.Initialize(new PushRuntimeSettings(MaximumConcurrency), (messageContext, cancellationToken) => { receivedMessages.Add(new IncomingMessage(messageContext.NativeMessageId, messageContext.Headers, messageContext.Body), cancellationToken); return(Task.CompletedTask); }, (_, __) => Task.FromResult(ErrorHandleResult.Handled) ); await messagePump.StartReceive(); }
public TransportDefinition CreateTransportDefinition() { var connectionString = Environment.GetEnvironmentVariable("RabbitMQTransport_ConnectionString") ?? "host=localhost"; var transport = new RabbitMQTransport(RoutingTopology.Conventional(QueueType.Classic), connectionString); return(transport); }
public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) { transport = new TestRabbitMQTransport(RoutingTopology.Conventional(queueType, type => type.FullName), ConnectionHelper.ConnectionString); configuration.UseTransport(transport); return(Task.CompletedTask); }
RabbitMQTransport CreateTransportDefinition(string connectionString) { return(new RabbitMQTransport(RoutingTopology.Conventional(QueueType.Classic), connectionString)); }