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


C# EndpointConfiguration.UseTransport方法代码示例

本文整理汇总了C#中EndpointConfiguration.UseTransport方法的典型用法代码示例。如果您正苦于以下问题:C# EndpointConfiguration.UseTransport方法的具体用法?C# EndpointConfiguration.UseTransport怎么用?C# EndpointConfiguration.UseTransport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EndpointConfiguration的用法示例。


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

示例1: AsyncMain

    static async Task AsyncMain()
    {

        #region sqlrelay-config
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.EndpointName("SqlRelay");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.DisableFeature<AutoSubscribe>();
        endpointConfiguration.UsePersistence<NHibernatePersistence>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
        endpointConfiguration.UseTransport<SqlServerTransport>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
        #endregion


        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            Console.WriteLine("\r\nSqlRelay is running - This endpoint will relay all events received to subscribers. Press any key to stop program\r\n");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:27,代码来源:Program.cs

示例2: AsyncMain

    static async Task AsyncMain()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.CustomTransport.Endpoint1");
#region UseDefinition
        endpointConfiguration.UseTransport<FileTransport>();
#endregion
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.DisableFeature<TimeoutManager>();

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            #region StartMessageInteraction
            await endpoint.Send("Samples.CustomTransport.Endpoint2", new MessageA());
            #endregion
            Console.WriteLine("MessageA sent. Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:26,代码来源:Program.cs

示例3: Main

        static void Main(string[] args)
        {
            var stopWatch = new Stopwatch();
            stopWatch.Start();
            DefaultFactory defaultFactory = LogManager.Use<DefaultFactory>();
            defaultFactory.Level(LogLevel.Fatal);

            var configuration = new EndpointConfiguration("Chocolate.Facility.Producer");

            configuration.UseTransport<MsmqTransport>();
            configuration.UsePersistence<InMemoryPersistence>();
            configuration.EnableInstallers();
            configuration.LimitMessageProcessingConcurrencyTo(Constants.MaxConcurrency);

            var bus = Endpoint.Start(configuration).GetAwaiter().GetResult();
            stopWatch.Stop();

            Console.WriteLine($"Initalizing the bus took { stopWatch.Elapsed.ToString("G")}");
            stopWatch.Reset();
            stopWatch.Start();
            Syncher.SyncEvent.Wait();
            stopWatch.Stop();
            Console.WriteLine($"Receiving #{ Syncher.SyncEvent.InitialCount } of msgs over the bus took { stopWatch.Elapsed.ToString("G")}");

            Console.ReadLine();
        }
开发者ID:danielmarbach,项目名称:SwissChocolate.Power,代码行数:26,代码来源:Program.cs

示例4: MainAsync

        private static async Task MainAsync()
        {
            var factory = LogManager.Use<DefaultFactory>();
            factory.Level(LogLevel.Debug);

            var configuration = new EndpointConfiguration();
            configuration.EndpointName("Sender");
            configuration.EnableInstallers();
            configuration.UseSerialization<JsonSerializer>();
            configuration.UsePersistence<InMemoryPersistence>();

            configuration.SendFailedMessagesTo("error");
           
            var transportConfiguration = configuration.UseTransport<AzureServiceBusTransport>();

            transportConfiguration.ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));


            // define routing (what used to be message endpoint mapping)
            var endpointName = new EndpointName("Receiver");
           // configuration.Routing().SetMessageDistributionStrategy(new SingleInstanceRoundRobinDistributionStrategy(), t => true);
            configuration.Routing().UnicastRoutingTable.RouteToEndpoint(typeof(TestCommand), endpointName);
            configuration.Routing().EndpointInstances.AddStatic(endpointName, new EndpointInstance(endpointName, null, null));

            var endpoint = await Endpoint.Start(configuration);

            Console.WriteLine("Press ESC to exit, any other key to send a message");
            Console.WriteLine("Press any other key to send a message");
            while (Console.ReadKey().Key != ConsoleKey.Escape)
            {
                await endpoint.Send<TestCommand>(m => m.Data = "Testing ASB send");
                Console.WriteLine("message sent");
            }
        }
开发者ID:SeanFeldman,项目名称:ASB.v7.Tester,代码行数:34,代码来源:Program.cs

示例5: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.MessageDurability.Sender";
        #region non-transactional

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MessageDurability.Sender");
        endpointConfiguration.UseTransport<MsmqTransport>()
            .Transactions(TransportTransactionMode.None);

        #endregion

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

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

示例6: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.RabbitMQ.Simple";
        #region ConfigureRabbit

        var endpointConfiguration = new EndpointConfiguration("Samples.RabbitMQ.Simple");
        var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
        transport.ConnectionString("host=localhost");

        #endregion
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        var myMessage = new MyMessage();
        await endpointInstance.SendLocal(myMessage)
            .ConfigureAwait(false);
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
        await endpointInstance.Stop()
            .ConfigureAwait(false);
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:25,代码来源:Program.cs

示例7: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.SqlServer.MultiInstanceSender";

        #region SenderConfiguration

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.SqlServer.MultiInstanceSender");
        endpointConfiguration.UseTransport<SqlServerTransport>()
            .EnableLagacyMultiInstanceMode(ConnectionProvider.GetConnection);
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        #endregion

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);

        Console.WriteLine("Press <enter> to send a message");
        Console.WriteLine("Press any other key to exit");
        try
        {
            while (true)
            {
                if (Console.ReadKey().Key != ConsoleKey.Enter)
                {
                    return;
                }
                PlaceOrder(endpoint);
            }
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:35,代码来源:Program.cs

示例8: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.SqlNHibernate.Receiver";
        Configuration hibernateConfig = new Configuration();
        hibernateConfig.DataBaseIntegration(x =>
        {
            x.ConnectionStringName = "NServiceBus/Persistence";
            x.Dialect<MsSql2012Dialect>();
        });

        #region NHibernate

        hibernateConfig.SetProperty("default_schema", "receiver");

        #endregion

        ModelMapper mapper = new ModelMapper();
        mapper.AddMapping<OrderMap>();
        hibernateConfig.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());

        new SchemaExport(hibernateConfig).Execute(false, true, false);

        #region ReceiverConfiguration

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.SqlNHibernate.Receiver");
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.AuditProcessedMessagesTo("audit");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UseTransport<SqlServerTransport>()
            .DefaultSchema("receiver")
            .UseSpecificSchema(e =>
            {
                if (e == "error" || e == "audit")
                {
                    return "dbo";
                }
                if (e == "Samples.SqlNHibernate.Sender")
                {
                    return "sender";
                }
                return null;
            });

        endpointConfiguration.UsePersistence<NHibernatePersistence>()
            .UseConfiguration(hibernateConfig);

        #endregion

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

示例9: MainAsync

    static async Task MainAsync()
    {
        Console.Title = "Samples.ASB.Polymorphic.Publisher";
        var endpointConfiguration = new EndpointConfiguration("Samples.ASB.Polymorphic.Publisher");
        var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
        transport.UseTopology<EndpointOrientedTopology>();
        transport.ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.DisableFeature<SecondLevelRetries>();

        IEndpointInstance endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);

        try
        {
            Console.WriteLine("Press '1' to publish the base event");
            Console.WriteLine("Press '2' to publish the derived event");
            Console.WriteLine("Press any other key to exit");

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

                Guid eventId = Guid.NewGuid();

                switch (key.Key)
                {
                    case ConsoleKey.D1:
                        await endpointInstance.Publish<BaseEvent>(e =>
                        {
                            e.EventId = eventId;
                        });
                        Console.WriteLine("BaseEvent sent. EventId: " + eventId);
                        break;

                    case ConsoleKey.D2:
                        await endpointInstance.Publish<DerivedEvent>(e =>
                        {
                            e.EventId = eventId;
                            e.Data = "more data";
                        });
                        Console.WriteLine("DerivedEvent sent. EventId: " + eventId);
                        break;

                    default:
                        return;
                }
            }

        }
        finally
        {
            await endpointInstance.Stop();
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:59,代码来源:Program.cs

示例10: Usage

        Usage(EndpointConfiguration endpointConfiguration)
        {
            #region rabbitmq-config-basic

            endpointConfiguration.UseTransport<RabbitMQTransport>();

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

示例11: UseTransport

        void UseTransport(EndpointConfiguration endpointConfiguration)
        {
            #region AzureStorageQueueTransportWithAzure

            endpointConfiguration.UseTransport<AzureStorageQueueTransport>();

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

示例12: TransportTransactionScope

 public void TransportTransactionScope()
 {
     #region TransportTransactionScope
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.UseTransport<MyTransport>()
         .Transactions(TransportTransactionMode.TransactionScope);
     #endregion
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:8,代码来源:TransportTransactions.cs

示例13: TransportTransactionAtomicSendsWithReceive

 public void TransportTransactionAtomicSendsWithReceive()
 {
     #region TransportTransactionAtomicSendsWithReceive
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.UseTransport<MyTransport>()
         .Transactions(TransportTransactionMode.SendsAtomicWithReceive);
     #endregion
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:8,代码来源:TransportTransactions.cs

示例14: TransportTransactionReceiveOnly

 public void TransportTransactionReceiveOnly()
 {
     #region TransportTransactionReceiveOnly
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.UseTransport<MyTransport>()
         .Transactions(TransportTransactionMode.ReceiveOnly);
     #endregion
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:8,代码来源:TransportTransactions.cs

示例15: Usage

        Usage(EndpointConfiguration endpointConfiguration)
        {
            #region AzureServiceBusTransportWithAzure

            endpointConfiguration.UseTransport<AzureServiceBusTransport>();

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


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