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


C# IEndpointInstance类代码示例

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


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

示例1: Run

    static async Task Run(IEndpointInstance endpointInstance)
    {
        Console.WriteLine("Press 'F' to send a message with a file stream");
        Console.WriteLine("Press 'H' to send a message with a http stream");
        Console.WriteLine("Press any key to exit");

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

            if (key.Key == ConsoleKey.F)
            {
                await SendMessageWithFileStream(endpointInstance)
                    .ConfigureAwait(false);
                continue;
            }
            if (key.Key == ConsoleKey.H)
            {
                await SendMessageWithHttpStream(endpointInstance)
                    .ConfigureAwait(false);
                continue;
            }
            break;
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:25,代码来源:Program.cs

示例2: SendOrder

    static async Task SendOrder(IEndpointInstance endpointInstance)
    {

        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)
            {
                break;
            }
            Guid id = Guid.NewGuid();

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

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

        }

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

示例3: Run

    static async Task Run(IEndpointInstance endpointInstance)
    {
        Console.WriteLine("Press 'J' to send a JSON message");
        Console.WriteLine("Press 'X' to send a XML message");
        Console.WriteLine("Press any key to exit");

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

            if (key.Key == ConsoleKey.X)
            {
                await SendXmlMessage(endpointInstance)
                    .ConfigureAwait(false);
                continue;
            }
            if (key.Key == ConsoleKey.J)
            {
                await SendJsonMessage(endpointInstance)
                    .ConfigureAwait(false);
                continue;
            }
            break;
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:26,代码来源:Program.cs

示例4: Run

    public static async Task Run(IEndpointInstance endpointInstance)
    {
        Console.WriteLine("Press 's' to send a valid message");
        Console.WriteLine("Press 'e' to send a failed message");
        Console.WriteLine("Press any key to exit");

        while (true)
        {
            var key = Console.ReadKey();
            Console.WriteLine();
            Console.WriteLine();
            switch (key.Key)
            {
                case ConsoleKey.S:
                    #region SendingSmall

                    var createProductCommand = new CreateProductCommand
                    {
                        ProductId = "XJ128",
                        ProductName = "Milk",
                        ListPrice = 4,
                        // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed
                        // before it reaches MSMQ.
                        Image = new byte[1024 * 1024 * 7]
                    };
                    await endpointInstance.SendLocal(createProductCommand)
                        .ConfigureAwait(false);
                    #endregion
                    break;
                case ConsoleKey.E:
                    try
                    {
                        #region SendingLarge

                        var productCommand = new CreateProductCommand
                        {
                            ProductId = "XJ128",
                            ProductName = "Really long product name",
                            ListPrice = 15,
                            // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed
                            // before it reaches MSMQ.
                            Image = new byte[1024 * 1024 * 7]
                        };
                        await endpointInstance.SendLocal(productCommand)
                            .ConfigureAwait(false);
                        #endregion
                    }
                    catch
                    {
                        //so the console keeps on running
                    }
                    break;
                default:
                    {
                        return;
                    }
            }
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:59,代码来源:Runner.cs

示例5: StartWcfHost

 static IDisposable StartWcfHost(IEndpointInstance endpointInstance)
 {
     WcfMapper wcfMapper = new WcfMapper(endpointInstance, "http://localhost:8080");
     wcfMapper.StartListening<EnumMessage, Status>();
     wcfMapper.StartListening<ObjectMessage, ReplyMessage>();
     wcfMapper.StartListening<IntMessage, int>();
     return wcfMapper;
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:8,代码来源:Program.cs

示例6: Expiration

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

示例7: Simple

 async void Simple(IEndpointInstance endpoint, SendOptions sendOptions, ILog log)
 {
     #region EnumCallback
     Message message = new Message();
     Status response = await endpoint.Request<Status>(message, sendOptions);
     log.Info("Callback received with response:" + response);
     #endregion
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:8,代码来源:Usage.cs

示例8: Subscribe

        async Task Subscribe(IEndpointInstance endpoint)
        {
            #region ExplicitSubscribe
            await endpoint.Subscribe<MyEvent>();

            await endpoint.Unsubscribe<MyEvent>();
            #endregion
        }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:8,代码来源:BasicOperations.cs

示例9: SendMessage

    static async Task SendMessage(IEndpointInstance endpointInstance)
    {
        Message message = new Message();
        await endpointInstance.SendLocal(message);

        Console.WriteLine();
        Console.WriteLine("Message sent");
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:8,代码来源:Program.cs

示例10: DefaultAction

        Task DefaultAction(IEndpointInstance endpoint)
        {
            #region DefaultCriticalErrorAction

            return endpoint.Stop();

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

示例11: SetInstance

 public static void SetInstance(IEndpointInstance endpoint)
 {
     if (Endpoint != null)
     {
         throw new Exception("Endpoint already set.");
     }
     Endpoint = endpoint;
 }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:8,代码来源:Hosting.cs

示例12: SendJsonMessage

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

示例13: Expiration

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

示例14: SendXmlMessage

 static async Task SendXmlMessage(IEndpointInstance endpointInstance)
 {
     var message = new MessageWithXml
     {
         SomeProperty = "Some content in a Xml message",
     };
     await endpointInstance.Send("Samples.MultiSerializer.Receiver", message)
         .ConfigureAwait(false);
     Console.WriteLine("XML message sent");
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:10,代码来源:Program.cs

示例15: PublishEvent

    static async Task PublishEvent(IEndpointInstance endpointInstance)
    {
        Guid eventId = Guid.NewGuid();

        await endpointInstance.Publish<IMyEvent>(m =>
        {
            m.EventId = eventId;
        });
        Console.WriteLine("Event published, id: " + eventId);

    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:11,代码来源:CommandSender.cs


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