瀏覽代碼

Merge branch 'master' of https://github.com/dotnetcore/CAP

# Conflicts:
#	src/DotNetCore.CAP.AzureServiceBus/AzureServiceBusConsumerClient.cs
master
Savorboard 4 年之前
父節點
當前提交
9bac150d2b
共有 5 個文件被更改,包括 16 次插入4 次删除
  1. +1
    -1
      src/DotNetCore.CAP.AzureServiceBus/AzureServiceBusConsumerClient.cs
  2. +1
    -1
      src/DotNetCore.CAP.Kafka/ITransport.Kafka.cs
  3. +2
    -0
      src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs
  4. +10
    -0
      src/DotNetCore.CAP.Kafka/KafkaHeaders.cs
  5. +2
    -2
      src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs

+ 1
- 1
src/DotNetCore.CAP.AzureServiceBus/AzureServiceBusConsumerClient.cs 查看文件

@@ -159,7 +159,7 @@ namespace DotNetCore.CAP.AzureServiceBus

private Task OnConsumerReceived(Message message, CancellationToken token)
{
var header = message.UserProperties.ToDictionary(x => x.Key, y => y.Value.ToString());
var header = message.UserProperties.ToDictionary(x => x.Key, y => y.Value?.ToString());
header.Add(Headers.Group, _subscriptionName);

var context = new TransportMessage(header, message.Body);


+ 1
- 1
src/DotNetCore.CAP.Kafka/ITransport.Kafka.cs 查看文件

@@ -43,7 +43,7 @@ namespace DotNetCore.CAP.Kafka
var result = await producer.ProduceAsync(message.GetName(), new Message<string, byte[]>
{
Headers = headers,
Key = message.GetId(),
Key = message.Headers.TryGetValue(KafkaHeaders.KafkaKey, out string kafkaMessageKey) && !string.IsNullOrEmpty(kafkaMessageKey) ? kafkaMessageKey : message.GetId(),
Value = message.Body
});



+ 2
- 0
src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs 查看文件

@@ -62,6 +62,8 @@ namespace DotNetCore.CAP.Kafka
}
headers.Add(Messages.Headers.Group, _groupId);

headers.Add(KafkaHeaders.KafkaKey, consumerResult.Key);

if (_kafkaOptions.CustomHeaders != null)
{
var customHeaders = _kafkaOptions.CustomHeaders(consumerResult);


+ 10
- 0
src/DotNetCore.CAP.Kafka/KafkaHeaders.cs 查看文件

@@ -0,0 +1,10 @@
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace DotNetCore.CAP.Kafka
{
public static class KafkaHeaders
{
public const string KafkaKey = "cap-kafka-key";
}
}

+ 2
- 2
src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs 查看文件

@@ -175,7 +175,7 @@ select count(Id) from {_recName} with (nolock) where StatusName = N'Failed';";
var sqlQuery2008 = $@"
with aggr as (
select replace(convert(varchar, Added, 111), '/','-') + '-' + CONVERT(varchar, DATEPART(hh, Added)) as [Key],
count(id) [Count]
count(Id) [Count]
from {tableName}
where StatusName = @statusName
group by replace(convert(varchar, Added, 111), '/','-') + '-' + CONVERT(varchar, DATEPART(hh, Added))
@@ -186,7 +186,7 @@ select [Key], [Count] from aggr with (nolock) where [Key] in @keys;";
var sqlQuery = $@"
with aggr as (
select FORMAT(Added,'yyyy-MM-dd-HH') as [Key],
count(id) [Count]
count(Id) [Count]
from {tableName}
where StatusName = @statusName
group by FORMAT(Added,'yyyy-MM-dd-HH')


Loading…
取消
儲存