Skip to content

adenisov/Weave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weave

Build status

The missing event-driven framework for .NET

Contains a high-level abstraction for the following EIP patterns

  1. Point-to-point channel
  2. Publish-subscribe channel
  3. Message bus
  4. Routing Slip

Usage

Contains implementation based on MassTransit. Sample code is using RabbitMq transport.

Create Endpoint

var endpoint = new RabbitMqEndpointBuilder()
                .WithContainerConfigurator(new AutofacContainerConfigurator(containerBuilder))
                .WithMessageTypeTopology("Test_Application_Name")
                .WithTopologyFeaturesConfiguration(new DefaultRabbitMqTopologyFeaturesConfiguration())
                .Build();

Create Messaging Module

    public sealed class TestMessagingModule : MessagingModule
    {
        protected override void Load(IMessagingModuleBuilder builder)
        {
            // Query
            builder.WithHandler<TestQueryHandler>();
            // Command
            builder.WithHandler<TestCommandHandler>();
            // Event
            builder.WithHandler<TestEventHandler>();
            
            // Sagas
            builder.WithSaga<TestSaga>();
        }
    }

Register Messaging Module

endpoint.RegisterMessagingModule(new TestMessagingModule());

Finish Configuration

endpoint.Configure();

var messageBus = endpoint.CreateMessageBus();

Run

// Query (fetch, direct, p2p)
await messageBus.RequestAsync(new TestQuery()).ConfigureAwait(false);

// Command (execute, direct/broadcast)
await messageBus.SendAsync(new TestCommand()).ConfigureAwait(false);

// Event (Pub-sub)
await messageBus.Publish(new TestEvent { OrderId = i }).ConfigureAwait(false);

About

The missing event-driven framework for .NET

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published