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


C# IBus.ReplyTo方法代码示例

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


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

示例1: Init

        public void Init()
        {

            bus = Configuration.Factory.CreateBusWithHosting();
         
            bus.ReplyTo<BasicRequest, BasicResponse>(req => new BasicResponse
            {
                Message = req.Message
            });

            bus.ReplyTo<StaticRequest, StaticResponse>(req => new StaticResponse
            {
                Message = req.Message
            });

            bus.ReplyTo<BaseRequest, ChildBase>(req =>
            {
                if (req.Message == "Child1")
                {
                    return new ChildResponse1 { Message = req.Message };
                }
                else
                {
                    return new ChildResponse2 { Message = req.Message };
                }
            });
        }
开发者ID:techtronics,项目名称:succubus,代码行数:27,代码来源:RequestResponse.cs

示例2: Init

        public void Init()
        {
            bus = Configuration.Factory.CreateBusWithHosting();
            

            bus.ReplyTo<BasicRequest, BasicResponse>(req => new BasicResponse
            {
                Message = req.Message
            });

            bus.ReplyTo<ErrorRequest, BasicResponse>(req =>
            {
                throw new Exception("Yeah, see, that doesn't really work");
            });

            bus.HandlerException += (sender, args) => are.Set();
        }
开发者ID:techtronics,项目名称:succubus,代码行数:17,代码来源:ErrorHandling.cs

示例3: Init

 public void Init()
 {
     bus = Configuration.Factory.CreateBusWithHosting();
     
     bus.ReplyTo<BasicRequest, BasicResponse>(req => new BasicResponse
     {
         Message = req.Message
     }, "ADDRESS");
 }
开发者ID:techtronics,项目名称:succubus,代码行数:9,代码来源:Addressing.cs

示例4: Init

        public void Init()
        {
            bus = Configuration.Factory.CreateBusWithHosting();

            bus.ReplyTo<BasicRequest, BasicResponse>(req => new BasicResponse
            {
                Message = req.Message
            }, marshal: (handler, request) =>
            {
                return handler(request);
            });
        }
开发者ID:techtronics,项目名称:succubus,代码行数:12,代码来源:Marshalling.cs

示例5: Init

        public void Init()
        {
            bus = Configuration.Factory.CreateBusWithHosting();
            #if ZEROMQ_BACKEND
            bus.Initialize(succubus => succubus.WithZeroMQ(config => config.StartMessageHost()));
            Thread.Sleep(2500);
            #else
            bus.Initialize(succubus => succubus.WithLoopback(clear: true, loopbackConfigurator: config => config.ReportRaw = true));
            #endif

            bus.ReplyTo<BasicRequest, BasicResponse>(req => new BasicResponse
            {
                Message = req.Message
            });
        }
开发者ID:techtronics,项目名称:succubus,代码行数:15,代码来源:Frames.cs

示例6: Init

        public void Init()
        {
            bus = Configuration.Factory.CreateBusWithHosting();

            // Setup chaining
            bus.ReplyTo<C1, C2>(c => new C2());
            bus.ReplyTo<C2, C3>(c => new C3());
            bus.ReplyTo<C3, C4>(c => new C4());

            // Complex routing
            bus.ReplyTo<A, B1>(a =>
                new B1()
                );
            bus.ReplyTo<A, B2>(a => new B2());
            bus.ReplyTo<B1, C>(b1 => new D1());
            bus.ReplyTo<B2, C>(b2 => new D2());
            bus.ReplyTo<C, Rb>(c => c is D1 ? (Rb)new R1 { C = c } : (Rb)new R2 { C = c });
            //Thread.Sleep(1000);
        }
开发者ID:techtronics,项目名称:succubus,代码行数:19,代码来源:Routing.cs


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