Skip to content

Instantly share code, notes, and snippets.

@perokvist
Last active December 13, 2015 18:08
Show Gist options
  • Save perokvist/4952751 to your computer and use it in GitHub Desktop.
Save perokvist/4952751 to your computer and use it in GitHub Desktop.
Simple.ServiceBus 0.1
public interface IServiceBus
{
Task PublishAsync<T>(T message);
IDisposable Subscribe<T>(IObserver<T> handler,SubscriptionConfiguration configuration=null);
}
var container = new ContainerBuilder()
.RegisterServiceBus()
.Build();
var serviceBus = container.Resolve<IServiceBus>();
var manager = container.Resolve<IServiceBusManager>();
var container = new ContainerBuilder()
.RegisterServiceBus()
.RegisterObservers(typeof(Program).Assembly)
.Build();
var resolver = new Resolver(container.ResolveNamed, container.Resolve);
serviceConfig.ConstructUsing(
s =>
new SubscriptionConfigurationService(resolver,
map => map.ListenTo<SimpleMessage>().Using<SimpleHandler>()
.WithConfiguration(new SubscriptionConfiguration("Test_1"))
));
serviceConfig.WhenStarted(sv => sv.Start());
serviceConfig.WhenStopped(sv => sv.Stop());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment