static async Task Main(string[] args) { var host = StreamHost.CreateDefaultBuilder <Program>(args).Build(); binderAwareChannelResolver = host.Services.GetService <IDestinationResolver <IMessageChannel> >() as BinderAwareChannelResolver; logger = host.Services.GetService <ILogger <Program> >(); await host.StartAsync(); }
public BinderAwareChannelResolverTest() { var searchDirectories = GetSearchDirectories("TestBinder"); var container = CreateStreamsContainer(searchDirectories, "spring:cloud:stream:defaultBinder=testbinder"); container.AddSingleton <IChannelInterceptor, ImmutableMessageChannelInterceptor>(); serviceProvider = container.BuildServiceProvider(); binder = serviceProvider.GetServices <IBinder>().OfType <IBinder <IMessageChannel> >().Single(); bindingTargetFactory = serviceProvider.GetServices <IBindingTargetFactory>().OfType <SubscribableChannelBindingTargetFactory>().Single(); resolver = serviceProvider.GetService <IDestinationResolver <IMessageChannel> >() as BinderAwareChannelResolver; options = serviceProvider.GetService <IOptions <BindingServiceOptions> >(); Assert.NotNull(binder); Assert.NotNull(bindingTargetFactory); Assert.NotNull(resolver); Assert.NotNull(options); }