• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.Logging.CustomFactory";
        #region ConfigureLogging

        var loggerDefinition = LogManager.Use<ConsoleLoggerDefinition>();

        // optionally set the log level in code or read from app.config
        loggerDefinition.Level(LogLevel.Info);

        // logging configuration should occur prior to endpoint configuration
        var endpointConfiguration = new EndpointConfiguration("Samples.Logging.CustomFactory");

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

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


示例2: Main

    static void Main()
    {
        LogManager.Use<DefaultFactory>()
            .Level(LogLevel.Warn);

        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.ErrorHandling.WithSLR");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press enter to send a message that will throw an exception.");
            Console.WriteLine("Press any key to exit");

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key != ConsoleKey.Enter)
                {
                    return;
                }
                MyMessage m = new MyMessage
                {
                    Id = Guid.NewGuid()
                };
                bus.SendLocal(m);
            }
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:30,代码来源:Program.cs


示例3: Main

    static void Main()
    {
        Console.Title = "Samples.Spring";
        Configure.Serialization.Json();
        #region ContainerConfiguration
        var configure = Configure.With();
        configure.Log4Net();
        configure.DefineEndpointName("Samples.Spring");
        var applicationContext = new GenericApplicationContext();
        applicationContext.ObjectFactory.RegisterSingleton("MyService", new MyService());
        configure.SpringFrameworkBuilder(applicationContext);
        #endregion
        configure.InMemorySagaPersister();
        configure.UseInMemoryTimeoutPersister();
        configure.InMemorySubscriptionStorage();
        configure.UseTransport<Msmq>();
        using (var startableBus = configure.UnicastBus().CreateBus())
        {
            var bus = startableBus.Start(() => configure.ForInstallationOn<Windows>().Install());
            var myMessage = new MyMessage();
            bus.SendLocal(myMessage);

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

    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:27,代码来源:Program.cs


示例4: Main

    static void Main()
    {
        Console.Title = "Samples.Logging.SerilogCustom";
        #region ConfigureSerilog
        Log.Logger = new LoggerConfiguration()
            .WriteTo.Console()
            .WriteTo.File("logFile.txt")
            .CreateLogger();
        #endregion

        #region UseConfig
        LogManager.Use<SerilogFactory>();

        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Logging.SerilogCustom");

        #endregion

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

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


示例5: AsyncMain

    static async Task AsyncMain()
    {
        LogManager.Use<DefaultFactory>()
            .Level(LogLevel.Warn);

        #region DisableSLR
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.ErrorHandling.WithoutSLR");
        busConfiguration.DisableFeature<SecondLevelRetries>();
        #endregion
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        busConfiguration.SendFailedMessagesTo("error");

        using (IBus bus = await Bus.Create(busConfiguration).StartAsync())
        {
            Console.WriteLine("Press enter to send a message that will throw an exception.");
            Console.WriteLine("Press any key to exit");

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key != ConsoleKey.Enter)
                {
                    return;
                }
                MyMessage m = new MyMessage
                {
                    Id = Guid.NewGuid()
                };
                await bus.SendLocalAsync(m);
            }
        }
    }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:35,代码来源:Program.cs


示例6: Main

    static void Main()
    {
        Console.Title = "Samples.Castle";
        #region ContainerConfiguration
        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Castle");

        var 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.EnableInstallers();

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


示例7: SendMessage

    public void SendMessage(int number)
    {
        MyMessage msg = new MyMessage();
        msg.number = number;

        myClient.Send(MyMsgType.CustomMsgType, msg);
    }
开发者ID:ifndefdeadmau5,项目名称:HLAPI_tutorial,代码行数:7,代码来源:MyNetManager.cs


示例8: Start

    static async Task Start()
    {
        Console.Title = "Samples.Ninject";
        #region ContainerConfiguration
        var endpointConfiguration = new EndpointConfiguration("Samples.Ninject");
        endpointConfiguration.SendFailedMessagesTo("error");

        var kernel = new StandardKernel();
        kernel.Bind<MyService>().ToConstant(new MyService());
        endpointConfiguration.UseContainer<NinjectBuilder>(c => c.ExistingKernel(kernel));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();


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

        try
        {
            var myMessage = new MyMessage();
            await endpointInstance.SendLocal(myMessage)
                .ConfigureAwait(false);

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally 
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:34,代码来源:Program.cs


示例9: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unity";
        #region ContainerConfiguration
        var endpointConfiguration = new EndpointConfiguration("Samples.Unity");
        var container = new UnityContainer();
        container.RegisterInstance(new MyService());
        endpointConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(container));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

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


示例10: Main

    static void Main()
    {
        Console.Title = "Samples.ErrorHandling.WithSLR";
        Configure.Serialization.Json();
        Configure configure = Configure.With();
        configure.Log4Net();
        configure.DefineEndpointName("Samples.ErrorHandling.WithSLR");
        configure.DefaultBuilder();
        configure.InMemorySagaPersister();
        configure.UseInMemoryTimeoutPersister();
        configure.InMemorySubscriptionStorage();
        configure.UseTransport<Msmq>();
        using (IStartableBus startableBus = configure.UnicastBus().CreateBus())
        {
            IBus bus = startableBus
                .Start(() => configure.ForInstallationOn<Windows>().Install());
            Console.WriteLine("Press enter to send a message that will throw an exception.");
            Console.WriteLine("Press any key to exit");

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key != ConsoleKey.Enter)
                {
                    return;
                }
                MyMessage m = new MyMessage
                {
                    Id = Guid.NewGuid()
                };
                bus.SendLocal(m);
            }
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:34,代码来源:Program.cs


示例11: Main

    static void Main()
    {
        LogManager.Use<DefaultFactory>()
            .Level(LogLevel.Warn);

        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.ErrorHandling.WithoutSLR");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.DisableFeature<SecondLevelRetries>();
        busConfiguration.EnableInstallers();

        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press any key to send a message that will throw an exception.");
            Console.WriteLine("To exit, press Ctrl + C");

            while (true)
            {
                Console.ReadLine();
                MyMessage m = new MyMessage
                              {
                                  Id = Guid.NewGuid()
                              };
                bus.SendLocal(m);
            }
        }
    }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs


示例12: Main

    static void Main()
    {
        Console.Title = "Samples.Logging.CustomFactory";
        #region ConfigureLogging

        var loggerDefinition = LogManager.Use<ConsoleLoggerDefinition>();

        // optionally set the log level in code or read from app.config
        loggerDefinition.Level(LogLevel.Info);

        // logging configuration should occur prior to endpoint configuration
        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Logging.CustomFactory");

        #endregion
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

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


示例13: Main

    static void Main()
    {
        Console.Title = "Samples.Castle";
        Configure.Serialization.Json();
        #region ContainerConfiguration
        var configure = Configure.With();
        configure.Log4Net();
        configure.DefineEndpointName("Samples.Castle");
        var container = new WindsorContainer();
        container.Register(Component.For<MyService>().Instance(new MyService()));
        configure.CastleWindsorBuilder(container);
        #endregion
        configure.InMemorySagaPersister();
        configure.UseInMemoryTimeoutPersister();
        configure.InMemorySubscriptionStorage();
        configure.UseTransport<Msmq>();
        using (var startableBus = configure.UnicastBus().CreateBus())
        {
            var bus = startableBus.Start(() => configure.ForInstallationOn<Windows>().Install());

            var myMessage = new MyMessage();
            bus.SendLocal(myMessage);

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:27,代码来源:Program.cs


示例14: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Headers");

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

        busConfiguration.RegisterComponents(components =>
        {
            components.ConfigureComponent<MutateIncomingMessages>(DependencyLifecycle.InstancePerCall);
            components.ConfigureComponent<MutateIncomingTransportMessages>(DependencyLifecycle.InstancePerCall);
            components.ConfigureComponent<MutateOutgoingMessages>(DependencyLifecycle.InstancePerCall);
            components.ConfigureComponent<MutateOutgoingTransportMessages>(DependencyLifecycle.InstancePerCall);
        });

        #region global-all-outgoing
        busConfiguration.AddHeaderToAllOutgoingMessages("AllOutgoing", "ValueAllOutgoing");
        IStartableBus startableBus = Bus.Create(busConfiguration);
        using (IBus bus = startableBus.Start())
        {
            #endregion

            #region sending
            MyMessage myMessage = new MyMessage();
            bus.SendLocal(myMessage);
            #endregion
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
开发者ID:eclaus,项目名称:docs.particular.net,代码行数:32,代码来源:Program.cs


示例15: Should_run_a_batch_nicely

        public void Should_run_a_batch_nicely()
        {
            const int batchSize = 10000;
            var callbackCount = 0;
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            using (var channel = bus.OpenPublishChannel(x => x.WithPublisherConfirms()))
            {
                for (int i = 0; i < batchSize; i++)
                {
                    var message = new MyMessage {Text = string.Format("Hello Message {0}", i)};
                    channel.Publish(message, x =>
                        x.OnSuccess(() => {
                            callbackCount++;
                        })
                        .OnFailure(() =>
                        {
                            callbackCount++;
                        }));
                }

                // wait until all the publications have been acknowleged.
                while (callbackCount < batchSize)
                {
                    if (stopwatch.Elapsed.Seconds > 10)
                    {
                        throw new ApplicationException("Aborted batch with timeout");
                    }
                    Thread.Sleep(10);
                }
            }
        }
开发者ID:stemarie,项目名称:EasyNetQ,代码行数:33,代码来源:PublishSubscribeWithPublisherConfirms.cs


示例16: Main

    static void Main()
    {
        Console.Title = "Samples.Logging.CommonLogging";

        #region ConfigureLogging

        Common.Logging.LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter
        {
            Level = LogLevel.Info
        };

        NServiceBus.Logging.LogManager.Use<CommonLoggingFactory>();

        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Logging.CommonLogging");

        #endregion

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

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


示例17: Start

    static void Start(IBus bus)
    {
        Console.WriteLine("Press 'p' to Publish MyEvent");
        Console.WriteLine("Press 's' to SendLocal MyMessage");
        Console.WriteLine("Press any other key to exit");

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

            var id = Guid.NewGuid();
            if (key.Key == ConsoleKey.P)
            {
                var myEvent = new MyEvent
                {
                    Id = id,
                };
                bus.Publish(myEvent);
                Console.WriteLine("Published MyEvent with Id {0}.", id);
                continue;
            }
            if (key.Key == ConsoleKey.S)
            {
                var eventMessage = new MyMessage
                {
                    Id = id,
                };
                bus.SendLocal(eventMessage);
                Console.WriteLine("Sent MyMessage with Id {0}.", id);
                continue;
            }
            return;
        }
    }
开发者ID:SimonCropp,项目名称:PubSubRepro,代码行数:35,代码来源:Program.cs


示例18: Main

    static void Main()
    {
        Console.Title = "Samples.Logging.Default";
        Configure.Serialization.Json();
        #region ConfigureLogging
        var configure = Configure.With();
        //Configures a ConsoleAppender with a threshold of Debug
        configure.Log4Net();
        configure.DefineEndpointName("Samples.Logging.Default");
        #endregion
        configure.DefaultBuilder();
        configure.InMemorySagaPersister();
        configure.UseInMemoryTimeoutPersister();
        configure.InMemorySubscriptionStorage();
        configure.UseTransport<Msmq>();
        using (var startableBus = configure.UnicastBus().CreateBus())
        {
            var bus = startableBus.Start(() => configure.ForInstallationOn<Windows>().Install());
            var myMessage = new MyMessage();
            bus.SendLocal(myMessage);

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

    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:26,代码来源:Program.cs


示例19: 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


示例20: Should_be_able_to_publish

 public void Should_be_able_to_publish()
 {
     var publishedMessage = new MyMessage {Text = "Hello There Fido!"};
     using (var channel = bus.OpenPublishChannel())
     {
         channel.Publish(publishedMessage);
     }
 }
开发者ID:erpeterson,项目名称:EasyNetQ,代码行数:8,代码来源:BasicPublishSubscribeTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyMissionBase类代码示例发布时间:2022-05-24
下一篇:
C# MyMemoryBlock类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap