Skip to content

Commit 786ed8f

Browse files
committed
Update docs & code cleanup.
1 parent 3ddea59 commit 786ed8f

File tree

14 files changed

+193
-30
lines changed

14 files changed

+193
-30
lines changed

docs/content/about/release-notes.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,169 @@ hide:
55

66
# Release Notes
77

8+
## Version 8.0.0 (Dec 14, 2023)
9+
10+
**Breaking Changes**
11+
12+
Removed `DefaultAuthenticationScheme`, `UseChallengeOnAuth`, `DefaultChallengeScheme` and `AuthorizationPolicy` options of DotNetCore.CAP.Dashboard.
13+
Now CAP dashboard auth/authz mechanism to leverage the "ASP.NET Core" way of doing it, see #1428.
14+
15+
* Streamlined auth via asp.net middlewares. (#1434) Thanks @mviegas
16+
17+
**Features:**
18+
19+
* Fully Support .NET 8.
20+
* Add `FallbackWindowLookbackSeconds` option to configure the retry processor to pick up the backtrack time window for Scheduled or Failed status messages. (#1455) Thanks @apatozi
21+
* Update IConsumerRegister.Default.cs to make dispose thread safe. (#1438) Thanks @blashbul
22+
* Compatible with .NET 8's dependency injection KeyedService. (#1436) Thanks @EashShow
23+
* Add virtual method to custom delay backtrack time window during delayed publishing large messges. (#1429) Thanks @PoteRii
24+
25+
**Bug Fixed:**
26+
27+
* Fixed message infinite retry of messages after subscriber is removed. (#1456) Thanks @bschwehn
28+
* Fixed open telemetry context lost on consumer retry and Baggage Propagation. (#1452) Thanks @bschwehn
29+
* Fixed NATS do not handle reconnect if the nats server is forcibly shutdown and then restarted. (#1449) Thanks @davidterins
30+
* Fixed outbox pattern messages does not recovery when using DotNetCore.CAP.InMemoryStorage. (#1439) Thanks @davidterins
31+
* Fixed open telemetry subscriber thows null reference when using azure service bus without connection string. (#1432) Thanks @demorgi
32+
* Fixed double registration of event handler for azure service bus. (#1427) Thanks @demorgi
33+
* Fixed publish delay message not working in sql server transaction. (#1422) Thanks @xiangxiren
34+
35+
## Version 7.2.2 (Nov 1, 2023)
36+
37+
**Features:**
38+
39+
* NATS support consumer config DeliverPolicy, default to New. (#1404)
40+
* Be able to configure if to subscribe to custom producer topic. (#1409) @demorgi
41+
42+
**Bug Fixed:**
43+
44+
* Try to fixes RabbitMQ basicConsume TimeOutException. (#1405) @yang-xiaodong
45+
* Change MongoDb index from descending to ascending. (#1415) Thanks @ustaserdar
46+
* Fixed parent span for "Event Persistence" activity trace. (#1407) Thanks @blashbul
47+
* Fixed OpenTelemetry Dynatrace IsRemote flag. (#1402) Thanks @phmonte
48+
* Mark Mongo time serialized to local instance time by default. (#1400)
49+
* Fixed k8s dashboard meta query error in standalone mode. @yang-xiaodong
50+
* Azure Service Bus, consumer fails if subscription has session enabled. (#1396, #1397) Thanks @demorgi
51+
52+
## Version 7.2.1 (Sep 8, 2023)
53+
54+
**Features:**
55+
56+
* The options `EnableConsumerPrefetch` and `UseDispatchingPerGroup` will work together without interference. (#1399)
57+
58+
**Bug Fixed:**
59+
60+
* Fixed SqlServer sql case sensitive in dashboard query. (#1389)
61+
* Fixed Redis endpoint is null in DotNetCore.CAP.OpenTelemetry. (#1384)
62+
63+
64+
## Version 7.2.0 (Jul 30, 2023)
65+
66+
**Breaking Changes**
67+
68+
* Remove `ProducerThreadCount` configuration option. Now automatically send task managed by the .NET thread pool. (#1380)
69+
* Change the SnowflakeId from static singleton to dependency injection singleton. (#1322)
70+
71+
**Features:**
72+
73+
* Add support for kubernetes discovery in dashboard. (#1362)
74+
* Message send task and consumer execute task managed by .net thread pool. (#1380)
75+
* Upgrade dependencies of NuGet packages.
76+
77+
**Bug Fixed:**
78+
79+
* Fixed BasicQosOptions not working as expected for RabbitMQ transport. (#1318)
80+
* Revert BeginTransactionAsync support. (#1376)
81+
* Fixed SqlServer transaction rollback message still sent out. (#1378)
82+
*
83+
## Version 7.1.4 (Jun 17, 2023)
84+
85+
**Features:**
86+
87+
* Add suppport `AutoDeleteOnIdle` option for Azure Service Bus. (#1350) Thanks @StevenDevooght
88+
89+
**Bug Fixed:**
90+
91+
* Keep the originall stack when consumer exception occurs. (#1341) Thanks @tomyangOK
92+
* Fixed multiple invocations caused when the retry processor exceeded the `FailedRetryInterval`. (#1359) Thanks @li-zheng-hao
93+
* Fixed thread blocking when enable `UseDispatchingPerGroup` option. (#1356) Thanks @sampsonye @li-zheng-hao
94+
*
95+
## Version 7.1.3 (May 17, 2023)
96+
97+
**Features:**
98+
99+
* Allow Explicit to set AllowAnonymous for the dashboard API. (#1335)
100+
* Update dashboard UI style
101+
* Add Cancellation token for BeginTransactionAsync. (#1317) Thanks @denis-tsv
102+
103+
**Bug Fixed:**
104+
105+
* Fixed postgresql AcquireLockAsync sql error. (#1320) Thanks @guochen2
106+
* Fixed redis transport order pool connections non-lazy created connections. (#1332) Thanks @MahmoudSamir101
107+
* Fixed mysql 8.0 storage skip locked not available bug. (#1330) Thanks @yang-xiaodong
108+
109+
## Version 7.1.2 (Apr 25, 2023)
110+
111+
**Bug Fixed:**
112+
113+
* Optimizing consumer duplicate detection warning logs. (#1314)
114+
* Fixes NATS consumption repeat when multiple consumer threads.
115+
* Fixes NATS transport infinity reconnect race condition. (#1311)
116+
117+
## Version 7.1.1 (Apr 7, 2023)
118+
119+
**Features:**
120+
121+
* Add support topic config for kafka. (#1303)
122+
* Log in to dashboard with JWT authentication. (#1306)
123+
124+
**Bug Fixed:**
125+
126+
* Fixed sqlserver character string convert to datetime2 exception. (#1302)
127+
* Fixed dashboard consul node proxy switch bug. (#1307)
128+
129+
## Version 7.1.0 (Mar 5, 2023)
130+
131+
**Features:**
132+
133+
* Add option to support distributed locks for retry processor. (#1272) Thanks @li-zheng-hao
134+
* Add option to support set BasicQos for RabbitMQ. (#1267) Thanks @nunorelvao
135+
* Add option to set queue type for RabbitMQ. (#1281) Thanks @PaulCousinsTTEducation
136+
* Add support publish to mutiple topics for Azure Service Bus. (#1283) Thanks @jonekdahl @mviegas
137+
138+
**Bug Fixed:**
139+
140+
* Fixed dashboard re-execute message throw null exception for MongoDB. (#1279) Thanks @cagataykiziltan
141+
142+
## Version 7.0.3 (Feb 2, 2023)
143+
144+
**Features:**
145+
146+
* Add SQL Filters option on topic subscribtion for AzureServiceBus. (#1263) Thanks @giorgilekveishvili-meama
147+
* Add EF BeginTransaction extensions overload with isolationlevel and async version. (#1266) @xshaheen
148+
149+
**Bug Fixed:**
150+
151+
* Fixed dashboard re-execute message throw null exception for SqlServer and Postgres. (#1259) Thanks @coolyuwk
152+
153+
## Version 7.0.2 (Jan 9, 2023)
154+
155+
**Features:**
156+
157+
* Change AzureServiceBus nuget package from Microsoft.Azure.ServiceBus to Azure.Messaging.ServiceBus. (https://github.com/dotnetcore/CAP/pull/1253)
158+
159+
**Bug Fixed:**
160+
161+
* Fixed redis streams json serialize exception. (#1254)
162+
* Fixed dashboard route in balzor server app. (not support wasm) (#1244)
163+
164+
## Version 7.0.1 (2022-12-16)
165+
166+
**Bug Fixed:**
167+
168+
* Fixed dashboard not working in balzor app. (#1244)
169+
* Fixed error when published Winform with 'Produce Single File'. (#1245)
170+
8171
## Version 7.0.0 (2022-11-27)
9172

10173
**Breaking Changes:**

samples/Sample.Kafka.PostgreSql/Controllers/ValuesController.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@
99
namespace Sample.Kafka.PostgreSql.Controllers
1010
{
1111
[Route("api/[controller]")]
12-
public class ValuesController : Controller, ICapSubscribe
12+
public class ValuesController(ICapPublisher producer) : Controller, ICapSubscribe
1313
{
14-
private readonly ICapPublisher _capBus;
15-
16-
public ValuesController(ICapPublisher producer)
17-
{
18-
_capBus = producer;
19-
}
20-
2114
[Route("~/control/start")]
2215
public async Task<IActionResult> Start([FromServices] IBootstrapper bootstrapper)
2316
{
@@ -36,7 +29,7 @@ public async Task<IActionResult> Stop([FromServices] IBootstrapper bootstrapper)
3629
[Route("~/delay/{delaySeconds:int}")]
3730
public async Task<IActionResult> Delay(int delaySeconds)
3831
{
39-
await _capBus.PublishDelayAsync(TimeSpan.FromSeconds(delaySeconds), "sample.kafka.postgrsql", DateTime.Now);
32+
await producer.PublishDelayAsync(TimeSpan.FromSeconds(delaySeconds), "sample.kafka.postgrsql", DateTime.Now);
4033

4134
return Ok();
4235
}
@@ -45,7 +38,7 @@ public async Task<IActionResult> Delay(int delaySeconds)
4538
[Route("~/without/transaction")]
4639
public async Task<IActionResult> WithoutTransaction()
4740
{
48-
await _capBus.PublishAsync("sample.kafka.postgrsql", DateTime.Now);
41+
await producer.PublishAsync("sample.kafka.postgrsql", DateTime.Now);
4942

5043
return Ok();
5144
}
@@ -55,12 +48,12 @@ public IActionResult AdonetWithTransaction()
5548
{
5649
using (var connection = new NpgsqlConnection(""))
5750
{
58-
using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false))
51+
using (var transaction = connection.BeginTransaction(producer, autoCommit: false))
5952
{
6053
//your business code
6154
connection.Execute("insert into test(name) values('test')", transaction: (IDbTransaction)transaction.DbTransaction);
6255

63-
_capBus.Publish("sample.kafka.postgrsql", DateTime.Now);
56+
producer.Publish("sample.kafka.postgrsql", DateTime.Now);
6457

6558
transaction.Commit();
6659
}

src/DotNetCore.CAP.MongoDB/ICapTransaction.MongoDB.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Core Community. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Diagnostics;
56
using System.Threading;
67
using System.Threading.Tasks;
@@ -56,6 +57,7 @@ public override void Dispose()
5657
{
5758
(DbTransaction as IClientSessionHandle)?.Dispose();
5859
DbTransaction = null;
60+
GC.SuppressFinalize(this);
5961
}
6062
}
6163

src/DotNetCore.CAP.SqlServer/ICapTransaction.SqlServer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public override void Dispose()
131131
}
132132

133133
DbTransaction = null;
134+
GC.SuppressFinalize(this);
134135
}
135136
}
136137

src/DotNetCore.CAP/CAP.Builder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public CapBuilder AddSubscribeFilter<T>() where T : class, ISubscribeFilter
111111
/// <param name="assemblies">Assemblies to scan subscriber</param>
112112
public CapBuilder AddSubscriberAssembly(params Assembly[] assemblies)
113113
{
114-
if (assemblies == null) throw new ArgumentNullException(nameof(assemblies));
114+
ArgumentNullException.ThrowIfNull(assemblies);
115115

116116
Services.Replace(new ServiceDescriptor(typeof(IConsumerServiceSelector),
117117
x => new AssemblyConsumerServiceSelector(x, assemblies),
@@ -126,7 +126,7 @@ public CapBuilder AddSubscriberAssembly(params Assembly[] assemblies)
126126
/// <param name="handlerAssemblyMarkerTypes"></param>
127127
public CapBuilder AddSubscriberAssembly(params Type[] handlerAssemblyMarkerTypes)
128128
{
129-
if (handlerAssemblyMarkerTypes == null) throw new ArgumentNullException(nameof(handlerAssemblyMarkerTypes));
129+
ArgumentNullException.ThrowIfNull(handlerAssemblyMarkerTypes);
130130

131131
AddSubscriberAssembly(handlerAssemblyMarkerTypes.Select(t => t.GetTypeInfo().Assembly).ToArray());
132132

src/DotNetCore.CAP/CAP.Options.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public CapOptions()
131131
/// <param name="extension"></param>
132132
public void RegisterExtension(ICapOptionsExtension extension)
133133
{
134-
if (extension == null) throw new ArgumentNullException(nameof(extension));
134+
ArgumentNullException.ThrowIfNull(extension);
135135

136136
Extensions.Add(extension);
137137
}

src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static class ServiceCollectionExtensions
2525
/// <returns>An <see cref="CapBuilder" /> for application services.</returns>
2626
public static CapBuilder AddCap(this IServiceCollection services, Action<CapOptions> setupAction)
2727
{
28-
if (setupAction == null) throw new ArgumentNullException(nameof(setupAction));
28+
ArgumentNullException.ThrowIfNull(setupAction);
2929

3030
services.AddSingleton(_ => services);
3131
services.TryAddSingleton(new CapMarkerService("CAP"));

src/DotNetCore.CAP/ICapTransaction.Base.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,21 @@ protected virtual void Flush()
4545
{
4646
while (!_bufferList.IsEmpty)
4747
{
48+
#pragma warning disable CA2012 // Use ValueTasks correctly
4849
if (_bufferList.TryDequeue(out var message))
4950
{
5051
var isDelayMessage = message.Origin.Headers.ContainsKey(Headers.DelayTime);
5152
if (isDelayMessage)
5253
{
54+
5355
_dispatcher.EnqueueToScheduler(message, DateTime.Parse(message.Origin.Headers[Headers.SentTime]!)).ConfigureAwait(false);
56+
5457
}
5558
else
5659
{
5760
_dispatcher.EnqueueToPublish(message).ConfigureAwait(false);
5861
}
62+
#pragma warning restore CA2012 // Use ValueTasks correctly
5963
}
6064
}
6165
}

src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private async Task PublishInternalAsync<T>(string name, T? value, IDictionary<st
185185

186186
#region tracing
187187

188-
private long? TracingBefore(Message message)
188+
private static long? TracingBefore(Message message)
189189
{
190190
if (s_diagnosticListener.IsEnabled(CapDiagnosticListenerNames.BeforePublishMessageStore))
191191
{
@@ -204,7 +204,7 @@ private async Task PublishInternalAsync<T>(string name, T? value, IDictionary<st
204204
return null;
205205
}
206206

207-
private void TracingAfter(long? tracingTimestamp, Message message)
207+
private static void TracingAfter(long? tracingTimestamp, Message message)
208208
{
209209
if (tracingTimestamp != null &&
210210
s_diagnosticListener.IsEnabled(CapDiagnosticListenerNames.AfterPublishMessageStore))
@@ -222,7 +222,7 @@ private void TracingAfter(long? tracingTimestamp, Message message)
222222
}
223223
}
224224

225-
private void TracingError(long? tracingTimestamp, Message message, Exception ex)
225+
private static void TracingError(long? tracingTimestamp, Message message, Exception ex)
226226
{
227227
if (tracingTimestamp != null &&
228228
s_diagnosticListener.IsEnabled(CapDiagnosticListenerNames.ErrorPublishMessageStore))

src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ private ConsumerExecutorDescriptor InitDescriptor(
196196
return descriptor;
197197
}
198198

199-
private ConsumerExecutorDescriptor? MatchUsingName(string key,
199+
private static ConsumerExecutorDescriptor? MatchUsingName(string key,
200200
IReadOnlyList<ConsumerExecutorDescriptor> executeDescriptor)
201201
{
202-
if (key == null) throw new ArgumentNullException(nameof(key));
202+
ArgumentNullException.ThrowIfNull(key);
203203

204204
return executeDescriptor.FirstOrDefault(x =>
205205
x.TopicName.Equals(key, StringComparison.InvariantCultureIgnoreCase));
@@ -208,7 +208,7 @@ private ConsumerExecutorDescriptor InitDescriptor(
208208
private ConsumerExecutorDescriptor? MatchWildcardUsingRegex(string key,
209209
IReadOnlyList<ConsumerExecutorDescriptor> executeDescriptor)
210210
{
211-
var group = executeDescriptor.First().Attribute.Group;
211+
var group = executeDescriptor[0].Attribute.Group;
212212
if (!_cacheList.TryGetValue(group, out var tmpList))
213213
{
214214
tmpList = executeDescriptor.Select(x => new RegexExecuteDescriptor<ConsumerExecutorDescriptor>

0 commit comments

Comments
 (0)