Last active
December 13, 2015 18:08
-
-
Save perokvist/4952751 to your computer and use it in GitHub Desktop.
Simple.ServiceBus 0.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IServiceBus | |
{ | |
Task PublishAsync<T>(T message); | |
IDisposable Subscribe<T>(IObserver<T> handler,SubscriptionConfiguration configuration=null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var container = new ContainerBuilder() | |
.RegisterServiceBus() | |
.Build(); | |
var serviceBus = container.Resolve<IServiceBus>(); | |
var manager = container.Resolve<IServiceBusManager>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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