Git Product home page Git Product logo

rebus.simpleinjector's Introduction

Rebus.SimpleInjector

install from nuget

Provides a SimpleInjector-based container adapter for Rebus.


To configure Rebus to work with your SimpleInjector container, simply call

container.ConfigureRebus(
    configurer => configurer
        .(...)
        .Start()
);

where the (...) is the part usually omitted from the Rebus configuration examples.

A slightly more realistic example (using Serilog, RabbitMQ and SQL Server) could look like this:

container.ConfigureRebus(
	configurer => configurer
		.Logging(l => l.Serilog())
		.Transport(t => t.UseRabbitMq("amqp://rebususer:[email protected]", "simpleinjectortest"))
		.Sagas(s => s.StoreInSqlServer("server=SQLMOTEL01.local; database=RebusStuff; trusted_connection=true"))
		.Start()
);

The examples shown so far will make the necessary container registrations, but the bus will not be started until either

  1. The container resolves the IBus instance, or
  2. You call the container.StartBus() extension method

so you should probably always remember to call container.StartBus() when your application starts (after it has finished making ALL of its container registrations).

So why is it different from all the other container adapters?

Beacuse SimpleInjector is very opinionated about its registration API and Rebus is pretty loose about it :)

How to register handlers?

Since Rebus' container adapters resolve ALL handlers that can handle an incoming message, handlers must be registered with the registration API for collections, e.g. like

container.RegisterCollection<IHandleMessages<SomeMessage>>(new []{ typeof(SomeMessageHandler) });

rebus.simpleinjector's People

Contributors

mookid8000 avatar trreeves avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.