Commit 9c3c6a9f authored by Savorboard's avatar Savorboard

Merge branch 'master' into v3.0

parents 801b3740 5f690e72
......@@ -3,7 +3,7 @@ Thank you for reporting an issue.
1. It's RECOMMENDED to submit PR for typo or tiny bug fix.
2. If this's a FEATURE request, please provide: details, pseudo codes if necessary.
3. If this's a BUG, please provide: course repetition, error log and configuration. Fill in as much of the template below as you're able.
3. If this's a BUG, please provide: course repetition, error log and configuration.
感谢您向我们反馈问题。
......@@ -12,4 +12,4 @@ Thank you for reporting an issue.
3. 如果是一个新需求,请提供:详细需求描述。
4. 如果是一个 BUG,请提供:复现步骤,错误日志以及相关配置。
5. 如果可能,请使用【英文】来提交,英文 issue 会被优先处理。
-->
\ No newline at end of file
-->
......@@ -253,7 +253,7 @@ services.AddCap(x =>
});
```
The default dashboard address is :[http://localhost:xxx/cap](http://localhost:xxx/cap) , you can also change the `cap` suffix to others with `d.MatchPath` configuration options.
The default dashboard address is :[http://localhost:xxx/cap](http://localhost:xxx/cap), you can also configure the `/cap` suffix with `x.UseDashboard(opt =>{ opt.MatchPath="/mycap"; })`.
![dashboard](http://images2017.cnblogs.com/blog/250417/201710/250417-20171004220827302-189215107.png)
......
......@@ -32,6 +32,6 @@ CAP 接收到消息之后会将消息进行 Persistent(持久化), 有关
## 消息数据清理
数据库消息表中具有一个 ExpiresAt 字段表示消息的过期时间,当消息发送成功或者消费成功后,CAP会将消息状态为 Successed 的 ExpiresAt 设置为 1小时 后过期,会将消息状态为 Failed 的 ExpiresAt 设置为 15天 后过期。
数据库消息表中具有一个 ExpiresAt 字段表示消息的过期时间,当消息发送成功或者消费成功后,CAP会将消息状态为 Successed 的 ExpiresAt 设置为 1 后过期,会将消息状态为 Failed 的 ExpiresAt 设置为 15天 后过期。
CAP 默认情况下会每隔一个小时将消息表的数据进行清理删除,避免数据量过多导致性能的降低。清理规则为 ExpiresAt 不为空并且小于当前时间的数据。 也就是说状态为Failed的消息(正常情况他们已经被重试了 50 次),如果你15天没有人工介入处理,同样会被清理掉。
\ No newline at end of file
CAP 默认情况下会每隔一个小时将消息表的数据进行清理删除,避免数据量过多导致性能的降低。清理规则为 ExpiresAt 不为空并且小于当前时间的数据。 也就是说状态为Failed的消息(正常情况他们已经被重试了 50 次),如果你15天没有人工介入处理,同样会被清理掉。
......@@ -14,7 +14,7 @@ Install-Package DotNetCore.CAP.Kafka
```
然后,你可以在 `Startup.cs``ConfigureServices` 方法中添加基于内存的配置项。
然后,你可以在 `Startup.cs``ConfigureServices` 方法中添加基于 Kafka 的配置项。
```csharp
......
......@@ -14,7 +14,7 @@ Install-Package DotNetCore.CAP.RabbitMQ
```
然后,你可以在 `Startup.cs``ConfigureServices` 方法中添加基于内存的配置项。
然后,你可以在 `Startup.cs``ConfigureServices` 方法中添加基于 RabbitMQ 的配置项。
```csharp
......@@ -65,4 +65,4 @@ services.AddCap(x =>
});
});
```
\ No newline at end of file
```
......@@ -97,12 +97,13 @@ namespace DotNetCore.CAP
_routes = routes ?? throw new ArgumentNullException(nameof(routes));
}
public Task Invoke(HttpContext context)
public async Task Invoke(HttpContext context)
{
if (!context.Request.Path.StartsWithSegments(_options.PathMatch,
out var matchedPath, out var remainingPath))
{
return _next(context);
await _next(context);
return;
}
// Update the path
......@@ -118,23 +119,27 @@ namespace DotNetCore.CAP
if (findResult == null)
{
return _next.Invoke(context);
await _next.Invoke(context);
return;
}
if (_options.Authorization.Any(filter => !filter.Authorize(dashboardContext)))
foreach (var authorizationFilter in _options.Authorization)
{
var authenticateResult = await authorizationFilter.AuthorizeAsync(dashboardContext);
if (authenticateResult) continue;
var isAuthenticated = context.User?.Identity?.IsAuthenticated;
context.Response.StatusCode = isAuthenticated == true
? (int) HttpStatusCode.Forbidden
: (int) HttpStatusCode.Unauthorized;
? (int)HttpStatusCode.Forbidden
: (int)HttpStatusCode.Unauthorized;
return Task.CompletedTask;
return;
}
dashboardContext.UriMatch = findResult.Item2;
return findResult.Item1.Dispatch(dashboardContext);
await findResult.Item1.Dispatch(dashboardContext);
}
finally
{
......
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace DotNetCore.CAP.Dashboard
{
public interface IDashboardAuthorizationFilter
{
bool Authorize(DashboardContext context);
Task<bool> AuthorizeAsync(DashboardContext context);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment