Explorar el Código

Fixes RabbitMQ federation plugin, some headers with object values cause cast exceptions. (#1036)

master
savorboard hace 3 años
padre
commit
f1500fd382
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. +9
    -1
      src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs

+ 9
- 1
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs Ver fichero

@@ -176,11 +176,19 @@ namespace DotNetCore.CAP.RabbitMQ
private void OnConsumerReceived(object sender, BasicDeliverEventArgs e)
{
var headers = new Dictionary<string, string>();

if (e.BasicProperties.Headers != null)
{
foreach (var header in e.BasicProperties.Headers)
{
headers.Add(header.Key, header.Value == null ? null : Encoding.UTF8.GetString((byte[])header.Value));
if (header.Value is byte[] val)
{
headers.Add(header.Key, Encoding.UTF8.GetString(val));
}
else
{
headers.Add(header.Key, header.Value?.ToString());
}
}
}



Cargando…
Cancelar
Guardar