A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/EasyNetQ/EasyNetQ below:

EasyNetQ/EasyNetQ: An easy to use .NET API for RabbitMQ

A Nice .NET API for RabbitMQ

Initial development was sponsored by travel industry experts 15below

Goals:

With the release of EasyNetQ v8, the method for connecting to a RabbitMQ broker has changed. The rest of the API remains unchanged.

To make working with RabbitMQ on .NET as easy as possible.

To connect to a RabbitMQ broker in v7...

    var bus = RabbitHutch.CreateBus("host=localhost");

To connect to a RabbitMQ broker in v8...

    var serviceCollection = new ServiceCollection();
    serviceCollection.AddEasyNetQ("host=localhost").UseSystemTextJson();

    using var provider = serviceCollection.BuildServiceProvider();
    var bus = provider.GetRequiredService<IBus>();

To publish a message...

    await bus.PubSub.PublishAsync(message);

To publish a message with a 5s delay...

    await bus.Scheduler.FuturePublishAsync(message, TimeSpan.FromSeconds(5));

To subscribe to a message...

    await bus.PubSub.SubscribeAsync<MyMessage>(
        "my_subscription_id", msg => Console.WriteLine(msg.Text)
    );

Remote procedure call...

    var request = new TestRequestMessage {Text = "Hello from the client! "};
    await bus.Rpc.RequestAsync<TestRequestMessage, TestResponseMessage>(request);

RPC server...

    await bus.Rpc.RespondAsync<TestRequestMessage, TestResponseMessage>(request =>
        new TestResponseMessage{ Text = request.Text + " all done!" }
    );

Just open EasyNetQ.sln in your preferred IDE or code editor and build. All the required dependencies for the solution file to build the software are included.

Thanks to all the people who already contributed!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4