Skip to content

A simple, easy to use asynchronous messaging framework for .NET

License

Notifications You must be signed in to change notification settings

JamesIrish/ServiceConnect-CSharp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Join the chat at https://gitter.im/R-Suite/ServiceConnect

ServiceConnect 5.0.0 is available at https://www.nuget.org/packages/ServiceConnect

  • New in ServiceConnect 5.0.0
    • Async consumers
    • Priority Queues support
    • Bug Fixes

ServiceConnect is a simple, easy to use asynchronous messaging framework for .NET.

Features

  • Support for many well-known Enterprise Integration Patterns
    • Point to Point
    • Publish/Subscribe
    • Process Manager
    • Recipient List
    • Scatter Gather
    • Routing Slip
    • Message Aggregation
    • Content-Based Router
  • Streaming
  • Retries
  • Auditing
  • .NET Core
  • SSL Support
  • Polymorphic message dispatch
  • Multi-threaded consumers
  • Intercept message-processing pipline with custom filters. See Filters sample application for a complete example.

Project Maturity

ServiceConnect (recently renamed from R.MessageBus) has been first released in May 2014. The current version is used by a number of high-profile financial applications in production environments. Public API is stable and no major changes are planned in the next version.

Simple example

In this example we simply send a message from one endpoint and consume the same message on another endpoint. See Point To Point sample application for a complete example.

1. Define your message

YourMessage is a .Net class that inherits from ServiceConnect.Interfaces.Message base class

public class YourMessage : Message
{
    public YourMessage(Guid correlationId) : base(correlationId){}
}
2. Send your message

In the standard command line Main method we start the bus with var bus = Bus.Initialize();. Calling initialize with no parameters will create an instance of the Bus with default configuration options. Next, we simply send YourMessage using bus.Send(new YourMessage(id), "YourConsumer"); - where the first argument is an instance of YourMessage, the second argument, "YourConsumer", is the receiving enpoint name. (We are going to configure "YourConsumer" next).

public class Program
{
    public static void Main()
    {
        var bus = Bus.Initialize();

        bus.Send(new YourMessage(Guid.NewGuid()), "YourConsumer");
    }
}
3. Receive your message

Again, we start the bus in the standard command line Main method. This time, however, with var bus = Bus.Initialize(config => config.SetEndPoint("YourConsumer"));. Because the method initialize can also take a single lambda/action parameter for custom configuration, we explicitly set the name of the receiving endpoint to "YourConsumer".

public class Program
{
    public static void Main()
    {
        var bus = Bus.Initialize(config => config.SetEndPoint("YourConsumer"));
    }
}

Finally, we define a "handler" that will receive the message. The handler is a .NET class that implements ServiceConnect.Interfaces.IMessageHandler<T> where the generic parameter T is the type of the message being consumed.

public class YourMessageHandler : IMessageHandler<YourMessage>
{
    public void Execute(YourMessage message)
    {
        Console.WriteLine("Received message - {0}", message.CorrelationId);
    }
}

About

A simple, easy to use asynchronous messaging framework for .NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.4%
  • Batchfile 0.6%