Skip to content
Sourcing messages from one or more sources using the observer pattern
Branch: dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
samples/OpenMessage.Samples.BasicMemory
src
tests
.gitattributes
.gitignore
OpenMessage.sln Added misc files Mar 16, 2017
build.ps1
global.json
readme.md

readme.md

OpenMessage

Master Branch: Build Status

Dev Branch: Build Status

OpenMessage aims to simplify the service bus paradigm by using pre-existing patterns to build an extensible architecture.

Getting Started

The library is based around the Microsoft.Extensions.* packages and relies upon the abstractions for depenency injection and logging allowing you the freedom to pick the implementations that best suit your scenario.

Assuming you want to connect to Azure Service Bus, here is how you configure OpenMessage:

1 - Add the provider:

PM> Install-Package OpenMessage.Providers.Azure

2 - Add the serializer (or write your own):

PM> Install-Package OpenMessage.Serializer.JsonNet

3 - Add the services to your service collection:

using OpenMessage;
using OpenMessage.Providers.Azure.Configuration;
using OpenMessage.Serializer.JsonNet;

...

IServiceCollection AddServices(IServiceCollection services)
{
    return services
            .AddOpenMessage()
            .AddJsonNetSerializer()
            .Configure<OpenMessageAzureProviderOptions>(config => {
                config.ConnectionString = "YOUR CONNECTION STRING HERE");    
            });
}

Sending Messages

4 - Add either a Queue/Topic dispatcher to the service collection:

IServiceCollection AddQueueBindings(IServiceCollection services)
{
    return services.AddQueueDispatcher<MyType>();    
}

5 - Inject an IDispatcher<T> into your class of choice:

internal class CommandGenerator
{
    private readonly IDispatcher<MyType> _dispatcher;
    
    public CommandGenerator(IDispatcher<MyType> dispatcher)
    {
        _dispatcher = dispatcher;    
    }    
}

Receiving Messages

4 - Add either a Queue/Subscription observable to the service collection:

IServiceCollection AddQueueBindings(IServiceCollection services)
{
    return services.AddQueueObservable<MyType>();    
}

5 - When done, resolve an IEnumerable<IBroker> from the service collection to begin receiving messages.

Serializers

You can add more than one serializer to OpenMessage. In this scenario, all registered serializers are checked to see whether they can deserialize the message. When serializing the last registered serializer is used, service collection provider depending.

Providers

You can’t perform that action at this time.