Skip to content

andrey-prokopyev/Contour

 
 

Repository files navigation

Contour

Contour status NuGet Status Nuget

Documentation

About

Contour is the message bus implementation to provide communication .NET services via different transport protocols. There is support AMQP/RabbitMQ transport now.

Quick start

Create a new endpoint to emit message:

var bus = new BusFactory().Create(cfg => // create an endpoint of message bus
{
    cfg.UseRabbitMq(); // specify transport
    cfg.SetEndpoint("HelloWorld.Emitter"); // specify an unique endpoint name
    cfg.SetConnectionString("amqp://"); // specify a connection string to a broker
    cfg.Route("greeting"); // declare outgoing message route
});

Send a message by one-way channel:

bus.Emit("greeting", new { Text = "Hello World!" }); // send message to the service bus

Create a new endpoint to receive messages:

var bus = new BusFactory().Create(cfg => // create an endpoint of message bus
{
    cfg.UseRabbitMq(); // specify transport
    cfg.SetEndpoint("HelloWorld.Consumer"); // specify an unique endpoint name
    cfg.SetConnectionString("amqp://"); // specify a connection string to a broker
        cfg.On<Message>( // register message handler for specific message route
            "greeting",
	(Message message) =>
	{
	    Console.WriteLine(message.Text);
	});
});

And declare incoming message type:

class Message
{
    public string Text { get; set; }
}

Build the project

  • clone the repository
  • run "build.cmd" to make sure all unit tests are still passing.
  • run "build.cmd RunAllTests" to make sure all integration and unit tests are still passing. In this case you have to configure access to the RabbitMQ broker.

Library license

The library is available under MIT. For more information see the License file in the GitHub repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.6%
  • Other 0.4%