本文整理汇总了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 };
}
});
}
示例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();
}
示例3: Init
public void Init()
{
bus = Configuration.Factory.CreateBusWithHosting();
bus.ReplyTo<BasicRequest, BasicResponse>(req => new BasicResponse
{
Message = req.Message
}, "ADDRESS");
}
示例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);
});
}
示例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
});
}
示例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);
}