|
|
@@ -168,12 +168,25 @@ namespace DotNetCore.CAP.RabbitMQ |
|
|
|
private void OnConsumerReceived(object sender, BasicDeliverEventArgs e) |
|
|
|
{ |
|
|
|
var headers = new Dictionary<string, string>(); |
|
|
|
foreach (var header in e.BasicProperties.Headers) |
|
|
|
if (e.BasicProperties.Headers != null) |
|
|
|
{ |
|
|
|
headers.Add(header.Key, header.Value == null ? null : Encoding.UTF8.GetString((byte[])header.Value)); |
|
|
|
foreach (var header in e.BasicProperties.Headers) |
|
|
|
{ |
|
|
|
headers.Add(header.Key, header.Value == null ? null : Encoding.UTF8.GetString((byte[])header.Value)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
headers.Add(Headers.Group, _queueName); |
|
|
|
|
|
|
|
if (_rabbitMQOptions.CustomHeaders != null) |
|
|
|
{ |
|
|
|
var customHeaders = _rabbitMQOptions.CustomHeaders(e); |
|
|
|
foreach (var customHeader in customHeaders) |
|
|
|
{ |
|
|
|
headers[customHeader.Key] = customHeader.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var message = new TransportMessage(headers, e.Body.ToArray()); |
|
|
|
|
|
|
|
OnMessageReceived?.Invoke(e.DeliveryTag, message); |
|
|
|