在nServiceBus的第5版中,我有一个跟踪飞行中消息的行为.
在行为中我能够访问DeliveryOptions(SendOptions)并查看目标队列,在NSB 6中对行为的更改我似乎无法再访问消息的目标.
有没有人知道从行为访问外发邮件的目的地?
v5中的先前代码:
public class PendingCommandBehavior : IBehavior<OutgoingContext>
{
public void Invoke(OutgoingContext context, Action next)
{
var sendOptions = context.DeliveryOptions as Nsb.Unicast.SendOptions;
if (sendOptions != null && context.OutgoingMessage.MessageIntent == Nsb.MessageIntentEnum.Send)
{
var destinationEndpoint = sendOptions.Destination.Queue;
Run Code Online (Sandbox Code Playgroud)
第6节中的代码:
public class PendingCommandBehavior : Behavior<IOutgoingSendContext>
{
public override async Task Invoke(IOutgoingSendContext context, Func<Task> next)
{
// context doesn't have any destination queue information???
Run Code Online (Sandbox Code Playgroud) 使用 NServiceBus 6 的回调功能,我发现无法提醒客户端请求处理程序失败。请求处理程序将经历所有可恢复性步骤,并最终将消息放入错误队列。同时,客户端只是坐在那里等待它的回复。
// Client code (e.g. in an MVC Controller)
var message = new FooRequest();
var response = await endpoint.Request<FooReponse>(message);
// Handler code
public class FooRequestHandler : IHandleMessages<FooRequest>
{
Task Handle(FooRequest message, IMessageHandlerContext context)
{
throw new Exception("Fails before the reply");
return context.Reply(new FooResponse());
}
}
Run Code Online (Sandbox Code Playgroud)
在上述情况下,如何让 MVC 控制器/调用代码知道处理程序已永久失败?
error-handling callback nservicebus nservicebus6 request-response
我有Endpoint一个Handle方法.我想在之前和之后立即采取措施Handle.通过改变,我之前能够完成这个步骤LogCommandEntryBehavior : Behavior<IIncomingLogicalMessageContext>.紧接着需要实施什么Handle?