Beispiel #1
0
        static async Task Main()
        {
            Lapine.Log.LoggerFactory = LoggerFactory.Create(config => {
                config.AddConsole();
                config.SetMinimumLevel(LogLevel.Debug);
            });

            var resetEvent = new ManualResetEventSlim();

            Console.CancelKeyPress += (_, args) => {
                args.Cancel = true;
                resetEvent.Set();
            };

            var connectionConfiguration = new ConnectionConfiguration(
                endpoints:                 new [] { new IPEndPoint(IPAddress.Loopback, 5672) },
                endpointSelectionStrategy: new InOrderEndpointSelectionStrategy(),
                authenticationStrategy:    new PlainAuthenticationStrategy(username: "******", password: "******"),
                peerProperties: PeerProperties.Default
                .WithProduct("Lapine.Workbench")
                .WithClientProvidedName("Lapine.Workbench")
                );

            var amqpClient = new AmqpClient(connectionConfiguration);

            await amqpClient.ConnectAsync();

            resetEvent.Wait();

            amqpClient.Dispose();
        }