How to debug both Handle
methods below?
I set breakpoints on both Handle
method within Visual Studio, and send message to Subscriber1
queue, but both methods are not called under VS.
public class SomeHandler : IHandleMessages<string>, IHandleMessages<IFailed<string>>
{
readonly IBus _bus;
public SomeHandle(IBus bus)
{
_bus = bus;
}
public async Task Handle(string message)
{
// do stuff that can fail here...
}
public async Task Handle(IFailed<string> failedMessage)
{
await _bus.Advanced.TransportMessage.Defer(TimeSpan.FromSeconds(30));
}
}
Below is the message sent to Subscriber1
.
I tried sending the message excluding either rbs2-msg-id
or rbs2-msg-type
, neither of them triggers the Handle
method above.
{
"body": "Test",
//other fields
"properties": {
"rbs2-intent": "pub",
"rbs2-msg-id": "cd57d735-3989-45b5-8a3c-e457fa61dc94",
"rbs2-return-address": "publisher",
"rbs2-senttime": "2019-05-27T15:07:25.1770000+01:00",
"rbs2-sender-address": "publisher",
"rbs2-msg-type": "System.String, mscorlib",
"rbs2-corr-id": "cd57d735-3989-45b5-8a3c-e457fa61dc94",
"rbs2-corr-seq": "0",
"rbs2-content-type": "application/json;charset=utf-8"
},
//other fields
}
Update 1
If an exception is thrown within Handle(string message)
, the method will be retried based on the 1st level try count. This is what we need.
However, Handle(IFailed<string> failedMessage)
is not invoked, how to debug Handle(IFailed<string> failedMessage)
like abvoe?
One note: when an exception is thrown within Handle(string message)
, IErrorHandler is NOT called, and AddTransportMessageForwarder is not called either, are these correct?