don't let every single possible client explode just because one malformed message was seen
This commit is contained in:
parent
013e4079c3
commit
d79ba3671b
@ -37,22 +37,25 @@ namespace franz
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
var cr = topicConsumer.Consume();
|
||||
var deserialized = JsonConvert.DeserializeObject(cr.Message.Value, messageType);
|
||||
if (deserialized != null && (deserialized as gray_messages.message).type == deserialized.GetType().ToString())
|
||||
{
|
||||
foreach (var waitingAction in externalSubscribers)
|
||||
try{
|
||||
var deserialized = JsonConvert.DeserializeObject(cr.Message.Value, messageType);
|
||||
if (deserialized != null && (deserialized as gray_messages.message).type == deserialized.GetType().ToString())
|
||||
{
|
||||
try
|
||||
foreach (var waitingAction in externalSubscribers)
|
||||
{
|
||||
waitingAction(deserialized);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Error.WriteLine("if I don't catch this error the whole thing dies so...");
|
||||
Console.Error.WriteLine(JsonConvert.SerializeObject(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(JsonSerializationException jse)
|
||||
{
|
||||
Console.Error.WriteLine($"couldn't deserialize {cr?.Message?.Value} as {messageType}; {jse}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Error.WriteLine("something happened in an action handler for: ");
|
||||
Console.Error.WriteLine(JsonConvert.SerializeObject(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user