当前位置: 首页>>代码示例>>C#>>正文


C# BusConfiguration类代码示例

本文整理汇总了C#中BusConfiguration的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration类的具体用法?C# BusConfiguration怎么用?C# BusConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BusConfiguration类属于命名空间,在下文中一共展示了BusConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Customize

 public void Customize(BusConfiguration configuration)
 {
     configuration.UsePersistence<DatabaseRoutingInMemoryPersistence>();
     configuration.DisableFeature<AutoSubscribe>();
     configuration.Pipeline.Register<DatabaseRouting.DatabaseRoutingStepInPipeline>();
     configuration.CustomConfigurationSource(new DatabaseRoutingConfiguration());
 }
开发者ID:ramonsmits,项目名称:NServiceBus-RoutingInDataBase,代码行数:7,代码来源:EndpointConfig.cs

示例2: AsyncMain

    static async Task AsyncMain()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.RavenDB.Client");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);

        Console.WriteLine("Press 'enter' to send a StartOrder messages");
        Console.WriteLine("Press any other key to exit");

        while (true)
        {
            ConsoleKeyInfo key = Console.ReadKey();
            Console.WriteLine();

            if (key.Key != ConsoleKey.Enter)
            {
                break;
            }

            Guid orderId = Guid.NewGuid();
            await endpoint.Send(new StartOrder
            {
                OrderId = orderId
            });
            Console.WriteLine("StartOrder Message sent with OrderId  " + orderId);
        }

        await endpoint.Stop();
    }
开发者ID:Diedzz,项目名称:docs.particular.net,代码行数:33,代码来源:Program.cs

示例3: Application_Start

    protected void Application_Start()
    {
        #region ApplicationStart

        ContainerBuilder builder = new ContainerBuilder();

        // Register your MVC controllers.
        builder.RegisterControllers(typeof(MvcApplication).Assembly);

        // Set the dependency resolver to be Autofac.
        IContainer container = builder.Build();

        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.MvcInjection.WebApplication");
        // ExistingLifetimeScope() ensures that IBus is added to the container as well,
        // allowing you to resolve IBus from your own components.
        busConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();

        bus = Bus.CreateSendOnly(busConfiguration);

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

        AreaRegistration.RegisterAllAreas();
        RegisterRoutes(RouteTable.Routes);

        #endregion
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:30,代码来源:Global.asax.cs

示例4: OnStart

        protected override void OnStart(string[] args)
        {
            try
            {
                container = new Container(x => x.AddRegistry<DependencyRegistry>());
                var myDocumentStore = new DocumentStore { ConnectionStringName = "EpiFlowDB" };

                var busConfiguration = new BusConfiguration();
                busConfiguration.EndpointName("EpiFlow.Messages");
                busConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container));
                busConfiguration.UseSerialization<JsonSerializer>();
                busConfiguration.UsePersistence<RavenDBPersistence>()
                    .UseDocumentStoreForSubscriptions(myDocumentStore)
                    .UseDocumentStoreForSagas(myDocumentStore)
                    .UseDocumentStoreForTimeouts(myDocumentStore);
                busConfiguration.UseTransport<RabbitMQTransport>();
                busConfiguration.DefineCriticalErrorAction(OnCriticalError);
                busConfiguration.Transactions().DisableDistributedTransactions();

                if (Environment.UserInteractive && Debugger.IsAttached)
                {
                    busConfiguration.EnableInstallers();
                }
                var startableBus = Bus.Create(busConfiguration);
                bus = startableBus.Start();
            }
            catch (Exception exception)
            {
                OnCriticalError("Failed to start the bus.", exception);
            }
        }
开发者ID:wettsten,项目名称:EpiFlow,代码行数:31,代码来源:ProgramService.cs

示例5: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.DataBus.Sender");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UseDataBus<FileShareDataBus>().BasePath(BasePath);
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press 'D' to send a databus large message");
            Console.WriteLine("Press 'N' to send a normal large message exceed the size limit and throw");
            Console.WriteLine("Press any other key to exit");

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                Console.WriteLine();

                if (key.Key == ConsoleKey.N)
                {
                    SendMessageTooLargePayload(bus);
                    continue;
                }

                if (key.Key == ConsoleKey.D)
                {
                    SendMessageLargePayload(bus);
                    continue;
                }
                return;
            }
        }
    }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:34,代码来源:Program.cs

示例6: Usage

 Usage(BusConfiguration busConfiguration)
 {
     #region DefiningEncryptedPropertiesAs
     ConventionsBuilder conventions = busConfiguration.Conventions();
     conventions.DefiningEncryptedPropertiesAs(info => info.Name.EndsWith("EncryptedProperty"));
     #endregion
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:7,代码来源:Usage.cs

示例7: AsyncMain

    static async Task AsyncMain()
    {
        #region ContainerConfiguration
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Unity");

        UnityContainer container = new UnityContainer();
        container.RegisterInstance(new MyService());
        busConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(container));
        #endregion
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        busConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            IBusSession busSession = endpoint.CreateBusSession();
            await busSession.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs

示例8: AsyncMain

    static async Task AsyncMain()
    {
        using (new RavenHost())
        {
            BusConfiguration busConfiguration = new BusConfiguration();
            busConfiguration.EndpointName("Samples.RavenDBCustomSagaFinder");
            busConfiguration.UseSerialization<JsonSerializer>();
            busConfiguration.EnableInstallers();
            busConfiguration.SendFailedMessagesTo("error");

            DocumentStore documentStore = new DocumentStore
            {
                Url = "http://localhost:32076",
                DefaultDatabase = "NServiceBus"
            };
            documentStore.RegisterListener(new UniqueConstraintsStoreListener());
            documentStore.Initialize();

            busConfiguration.UsePersistence<RavenDBPersistence>()
                .DoNotSetupDatabasePermissions() //Only required to simplify the sample setup
                .SetDefaultDocumentStore(documentStore);

            IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
            await endpoint.SendLocal(new StartOrder
            {
                OrderId = "123"
            });

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();

            await endpoint.Stop();
        }
    }
开发者ID:Diedzz,项目名称:docs.particular.net,代码行数:34,代码来源:Program.cs

示例9: Customize

        public void Customize(BusConfiguration config)
        {
            config.DisableFeature<TimeoutManager>();
            config.DisableFeature<SecondLevelRetries>();
            config.DisableFeature<Sagas>();

        }
开发者ID:gaurav0106,项目名称:NServiceBus.Azure.Samples,代码行数:7,代码来源:EndpointConfig.cs

示例10: AsyncMain

    static async Task AsyncMain()
    {
        #region ContainerConfiguration

        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Castle");

        WindsorContainer container = new WindsorContainer();
        container.Register(Component.For<MyService>().Instance(new MyService()));

        busConfiguration.UseContainer<WindsorBuilder>(c => c.ExistingContainer(container));

        #endregion

        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.SendFailedMessagesTo("error");
        busConfiguration.EnableInstallers();

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            await endpoint.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:31,代码来源:Program.cs

示例11: Config_file_connection_string_convention_has_precedence_over_code_configured_endpoint_connection_info

        public void Config_file_connection_string_convention_has_precedence_over_code_configured_endpoint_connection_info()
        {
            var busConfig = new BusConfiguration();
            busConfig.UseTransport<SqlServerTransport>().UseSpecificConnectionInformation(
                EndpointConnectionInfo.For("Endpoint1").UseConnectionString("Source=Code").UseSchema("CodeSchema"),
                EndpointConnectionInfo.For("Endpoint2").UseConnectionString("Source=Code").UseSchema("CodeSchema"));

            var connectionConfig = new ConnectionConfig(new List<ConnectionStringSettings>()
            {
                new ConnectionStringSettings("NServiceBus/Transport/Endpoint1", "Source=Config; Queue Schema=ConfigSchema")
            });

            var builder = Activate(busConfig, connectionConfig);
            var connectionProvider = builder.Build<IConnectionStringProvider>();

            //Config
            var connectionParams = connectionProvider.GetForDestination(Address.Parse("Endpoint1"));
            Assert.IsTrue("Source=Config".Equals(connectionParams.ConnectionString, StringComparison.InvariantCultureIgnoreCase));
            Assert.AreEqual("ConfigSchema", connectionParams.Schema);

            //Fallback - code
            connectionParams = connectionProvider.GetForDestination(Address.Parse("Endpoint2"));
            Assert.IsTrue("Source=Code".Equals(connectionParams.ConnectionString, StringComparison.InvariantCultureIgnoreCase));
            Assert.AreEqual("CodeSchema", connectionParams.Schema);
        }
开发者ID:james-wu,项目名称:NServiceBus.SqlServer,代码行数:25,代码来源:ConnectionConfigTests.cs

示例12: Run

        public static void Run(
            int maximumNumberOfTweetsPerCatchUp,
            TimeSpan defaultTransactionTimeout,
            string nserviceBusConnectionString,
            string endpointName,
            string consumerKey,
            string consumerSecret,
            string accessToken,
            string accessTokenSecret)
        {
            var busConfiguration = new BusConfiguration();
            busConfiguration.Transactions().DoNotWrapHandlersExecutionInATransactionScope();
            busConfiguration.Transactions().DefaultTimeout(defaultTransactionTimeout);
            busConfiguration.EndpointName(endpointName);
            busConfiguration.UseSerialization<JsonSerializer>();
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence<NHibernatePersistence>().ConnectionString(nserviceBusConnectionString);
            busConfiguration.ApplyMessageConventions();
            busConfiguration.RegisterComponents(c=>c.RegisterSingleton<ITweetService>(
                new TweetService(maximumNumberOfTweetsPerCatchUp, consumerKey, consumerSecret, accessToken, accessTokenSecret)));

            using (Bus.Create(busConfiguration).Start())
            {
                Console.ReadLine();
            }
        }
开发者ID:adamralph,项目名称:HashBus,代码行数:26,代码来源:App.cs

示例13: AsyncMain

    static async Task AsyncMain()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.WcfCallbacks");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        busConfiguration.SendFailedMessagesTo("error");

        #region startbus


        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            IBusSession busSession = endpoint.CreateBusSession();

            using (StartWcfHost(busSession))
            {
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
        }
        finally
        {
            await endpoint.Stop();
        }

        #endregion
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:30,代码来源:Program.cs

示例14: Main

    static void Main()
    {
        Console.Title = "Samples.CustomNhMappings.XmlMapping";
        var nhConfiguration = new Configuration();

        nhConfiguration.SetProperty(Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
        nhConfiguration.SetProperty(Environment.ConnectionDriver, "NHibernate.Driver.Sql2008ClientDriver");
        nhConfiguration.SetProperty(Environment.Dialect, "NHibernate.Dialect.MsSql2008Dialect");
        nhConfiguration.SetProperty(Environment.ConnectionStringName, "NServiceBus/Persistence");

        AddMappingsFromFilesystem(nhConfiguration);

        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.CustomNhMappings.XmlMapping");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();

        var persistence = busConfiguration.UsePersistence<NHibernatePersistence>();
        persistence.UseConfiguration(nhConfiguration);

        using (var bus = Bus.Create(busConfiguration).Start())
        {
            var startOrder = new StartOrder
            {
                OrderId = "123"
            };
            bus.SendLocal(startOrder);
            
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:32,代码来源:Program.cs

示例15: AsyncMain

    static async Task AsyncMain()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.MessageMutators");
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.SendFailedMessagesTo("error");

        #region ComponentRegistartion
        busConfiguration.RegisterComponents(components =>
        {
            components.ConfigureComponent<ValidationMessageMutator>(DependencyLifecycle.InstancePerCall);
            components.ConfigureComponent<TransportMessageCompressionMutator>(DependencyLifecycle.InstancePerCall);
        });
        #endregion

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            IBusSession busSession = endpoint.CreateBusSession();
            await Runner.Run(busSession);
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:27,代码来源:Program.cs


注:本文中的BusConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。