Ejemplo n.º 1
0
        /// <summary>
        /// Uses twino bus and connects to the server
        /// </summary>
        public static IServiceProvider UseTwinoBus <TIdentifier>(this IServiceProvider provider)
        {
            MicrosoftDependencyConsumerFactory.Provider = provider;
            TmqStickyConnector <TIdentifier> connector = provider.GetService <TmqStickyConnector <TIdentifier> >();

            connector.Run();
            return(provider);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds Twino connector with configuration
        /// </summary>
        public static ITwinoServiceCollection UseTwinoBus(this ITwinoServiceCollection services, Action <TwinoConnectorBuilder> config)
        {
            TwinoConnectorBuilder builder = new TwinoConnectorBuilder(services);

            config(builder);

            TmqStickyConnector connector = builder.Build();

            AddConsumersTwino(services, connector, builder);
            services.AddSingleton(connector);
            services.AddSingleton(connector.Bus);
            services.AddSingleton(connector.Bus.Direct);
            services.AddSingleton(connector.Bus.Queue);
            services.AddSingleton(connector.Bus.Route);

            connector.Run();
            return(services);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds Twino connector with configuration
        /// </summary>
        public static ITwinoServiceCollection UseTwinoBus <TIdentifier>(this ITwinoServiceCollection services, Action <TwinoConnectorBuilder> config)
        {
            TwinoConnectorBuilder builder = new TwinoConnectorBuilder(services);

            config(builder);

            TmqStickyConnector <TIdentifier> connector = builder.Build <TIdentifier>();

            AddConsumersTwino(services, connector, builder);
            services.AddSingleton(connector);

            TwinoBus <TIdentifier> bus = (TwinoBus <TIdentifier>)connector.Bus;

            services.AddSingleton <ITwinoBus <TIdentifier> >(bus);
            services.AddSingleton <ITwinoDirectBus <TIdentifier> >((TwinoDirectBus <TIdentifier>)bus.Direct);
            services.AddSingleton <ITwinoQueueBus <TIdentifier> >((TwinoQueueBus <TIdentifier>)bus.Queue);
            services.AddSingleton <ITwinoRouteBus <TIdentifier> >((TwinoRouteBus <TIdentifier>)bus.Route);

            connector.Run();
            return(services);
        }