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


C# IBus.Send方法代码示例

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


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

示例1: StartSaga

        private static void StartSaga(IBus bus, int iterasjoner = 1)
        {
            const string Tekst = "en veldig lang tekst skal dette bli og det er ingen grenser for hvor frekk den kan være";
            var tekstHash = Tekst.GetHashCode();
            var ordListe = Tekst.Split(new[] { ' ' });

            for (var i = 0; i < iterasjoner; i++)
            {
                var sagaId = Guid.NewGuid();
                Console.Out.WriteLine(@"KLIENT: Starter saga med id '{0}'.", sagaId);

                bus.Send("Server", new TekstSagaStartMelding
                {
                    SagaId = sagaId,
                    TekstHash = tekstHash
                });

                for (var ordTeller = 0; ordTeller < ordListe.Count(); ordTeller++)
                {
                    bus.Send("Server", new TekstSagaFragment
                    {
                        SagaId = sagaId,
                        FragmentId = ordTeller,
                        Fragment = ordListe[ordTeller]
                    });
                }
            }
        } 
开发者ID:stiano,项目名称:geek-night-7-servicebus.net,代码行数:28,代码来源:EksempelPåSaga.cs

示例2: SendMessages

 public override async Task SendMessages(IBus bus, Func<bool> shouldKeepSending)
 {
     while (shouldKeepSending())
     {
         await bus.Send(new FooCommand());
         await bus.Send(new BarCommand());
         await bus.Send(new BazCommand());
         await bus.Send(new QuxCommand());
         IncrementExpectedMessageCount(4);
     }
 }
开发者ID:fenix2222,项目名称:Nimbus,代码行数:11,代码来源:WhenSendingManyCommandsOfDifferentTypes.cs

示例3: SendMessages

 public override IEnumerable<Task> SendMessages(IBus bus)
 {
     for (var i = 0; i < NumMessagesToSend/4; i++)
     {
         yield return bus.Send(new FooCommand());
         yield return bus.Send(new BarCommand());
         yield return bus.Send(new BazCommand());
         yield return bus.Send(new QuxCommand());
         Console.Write(".");
     }
     Console.WriteLine();
 }
开发者ID:joshka,项目名称:Nimbus,代码行数:12,代码来源:WhenSendingManyCommandsOfDifferentTypes.cs

示例4: RelocateCustomer

        private static void RelocateCustomer(IBus bus, Guid aggregateId)
        {
            bus.Send(new RelocatingCustomerCommand(aggregateId, "Messestraße",  "2", "4444", "Linz"));

            Console.WriteLine("Customer relocated. Press any key to show list of customers.");
            Console.ReadLine();
        }
开发者ID:JoergEg,项目名称:CQRS-Sample,代码行数:7,代码来源:Program.cs

示例5: OnStart

    protected override void OnStart(string[] args)
    {
        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("SendNsbMessage");
        busConfiguration.UseSerialization<XmlSerializer>();

        if (Environment.UserInteractive && Debugger.IsAttached)
        {
            //TODO: For production use, please select a durable persistence.
            busConfiguration.UsePersistence<InMemoryPersistence>();

            //TODO: For production use, please script your installation.
            busConfiguration.EnableInstallers();
            busConfiguration.Conventions()
                .DefiningCommandsAs(t => t.Namespace != null && t.Namespace == "IntegrationSample.Messages.Commands");
            busConfiguration.Conventions()
                .DefiningEventsAs(t => t.Namespace != null && t.Namespace == "IntegrationSample.Messages.Events");
        }
        var startableBus = Bus.Create(busConfiguration);
        bus = startableBus.Start();
        Console.WriteLine("\r\nPress '1' to send an NSB message\r\n");

        while (true)
        {
            var key = Console.ReadKey(true);
            if (key.KeyChar == '1')
                bus.Send(new ProcessOrder()
                {
                    OrderId = Guid.NewGuid(),

                });
            Console.WriteLine("\r\nPress '1' to send an NSB message\r\n");
        }
    }
开发者ID:weralabaj,项目名称:Work,代码行数:34,代码来源:ProgramService.cs

示例6: SendOrder

    static void SendOrder(IBus bus)
    {

        Console.WriteLine("Press enter to send a message");
        Console.WriteLine("Press any key to exit");

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

            if (key.Key != ConsoleKey.Enter)
            {
                return;
            }
            Guid id = Guid.NewGuid();

            PlaceOrder placeOrder = new PlaceOrder
            {
                Product = "New shoes",
                Id = id
            };
            bus.Send("Samples.StepByStep.Server", placeOrder);

            Console.WriteLine("Sent a new PlaceOrder message with id: {0}", id.ToString("N"));

        }

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

示例7: SendOrder

        static void SendOrder(IBus bus)
        {
            Console.Title = "Client";
            Console.Clear();
            Console.WriteLine("Press enter to send a message");
            Console.WriteLine("Press any key to exit");

            int caseId = 101;

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

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

                PlaceOrderCommand placeOrder = new PlaceOrderCommand
                {
                    SagaId = Guid.NewGuid(),
                    CaseId = caseId++
                };

                bus.Send(placeOrder);

                Console.WriteLine("Sent a new PlaceOrder message for CaseId:{0} with UniqueId: {1}", placeOrder.CaseId, placeOrder.SagaId.ToString("N"));
            }
        }
开发者ID:gaurav0106,项目名称:OrderAutomation,代码行数:30,代码来源:Program.cs

示例8: OnSucceeded

 public void OnSucceeded(IBus bus, IMessageInformation info)
 {
     if (info.MessageType != typeof(MessageInformation))
     {
         bus.Send(Convert(info));
     }
 }
开发者ID:yonglehou,项目名称:NsqSharp,代码行数:7,代码来源:MessageAuditor.cs

示例9: OnBusStarted

 public void OnBusStarted(IBusConfiguration config, IBus bus)
 {
     if (config.IsConsoleMode)
     {
         Task.Factory.StartNew(() =>
         {
             // uncomment to send lots of messages
             //for (int i = 0; i < 1000; i++)
             {
                 bus.Send<GetCustomersCommand>();
                 bus.Send<GetInvoicesCommand>();
                 bus.Send<GetProductsCommand>();
             }
         });
     }
 }
开发者ID:yonglehou,项目名称:NsqSharp,代码行数:16,代码来源:Program.cs

示例10: Expiration

 // Shut down server before sending this message, after 30 seconds, the message will be moved to Transactional dead-letter messages queue.
 static void Expiration(IBus bus)
 {
     bus.Send("Samples.Unobtrusive.Server", new MessageThatExpires
     {
         RequestId = new Guid()
     });
     Console.WriteLine("message with expiration was sent");
 }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:9,代码来源:CommandSender.cs

示例11: Expiration

 // Shut down server before sending this message, after 30 seconds, the message will be moved to Transactional dead-letter messages queue.
 static void Expiration(IBus bus)
 {
     bus.Send(new MessageThatExpires
              {
                  RequestId = new Guid()
              });
     Console.WriteLine("message with expiration was sent");
 }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:9,代码来源:CommandSender.cs

示例12: Usage

        Usage(IBus bus)
        {
            #region custom-correlationid

            bus.Send("TargetQueue", "My custom correlation id", new MyRequest());

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

示例13: Usage

 Usage(IBus bus)
 {
     #region RequestImmediateDispatchUsingScope
     using (new TransactionScope(TransactionScopeOption.Suppress))
     {
         bus.Send(new MyMessage());
     }
     #endregion
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:9,代码来源:Usage.cs

示例14: SendJsonMessage

 static void SendJsonMessage(IBus bus)
 {
     MessageWithJson message = new MessageWithJson
     {
         SomeProperty = "Some content in a json message",
     };
     bus.Send("Samples.MultiSerializer.Receiver", message);
     Console.WriteLine("Json Message sent");
 }
开发者ID:eclaus,项目名称:docs.particular.net,代码行数:9,代码来源:Program.cs

示例15: SendBinaryMessage

 static void SendBinaryMessage(IBus bus)
 {
     MessageWithBinary message = new MessageWithBinary
     {
         SomeProperty = "Some content in a binary message",
     };
     bus.Send("Sample.MultiSerializer.Receiver", message);
     Console.WriteLine("Binary message sent");
 }
开发者ID:jh8848,项目名称:docs.particular.net,代码行数:9,代码来源:Program.cs


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