-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to file-scoped namespaces (#1586)
Modified : src/DotNetCore.CAP.NATS/CAP.NATSCapOptionsExtension.cs Modified : src/DotNetCore.CAP.NATS/CAP.NATSOptions.cs Modified : src/DotNetCore.CAP.NATS/CAP.Options.Extensions.cs Modified : src/DotNetCore.CAP.NATS/IConnectionPool.Default.cs Modified : src/DotNetCore.CAP.NATS/IConnectionPool.cs Modified : src/DotNetCore.CAP.NATS/ITransport.NATS.cs Modified : src/DotNetCore.CAP.NATS/NATSConsumerClient.cs Modified : src/DotNetCore.CAP.NATS/NATSConsumerClientFactory.cs Modified : src/DotNetCore.CAP.RabbitMQ/RabbitMQBasicConsumer.cs Modified : src/DotNetCore.CAP/Diagnostics/EventCounterSource.Cap.cs Modified : src/DotNetCore.CAP/Internal/ISnowflakeId.cs
- Loading branch information
1 parent
8397a5a
commit 1cadd3a
Showing
11 changed files
with
546 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
// Copyright (c) .NET Core Community. All rights reserved. | ||
// 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; | ||
using DotNetCore.CAP; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Microsoft.Extensions.DependencyInjection | ||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class CapOptionsExtensions | ||
{ | ||
public static class CapOptionsExtensions | ||
/// <summary> | ||
/// Configuration to use NATS in CAP. | ||
/// </summary> | ||
/// <param name="options">CAP configuration options</param> | ||
/// <param name="bootstrapServers">NATS bootstrap server urls.</param> | ||
public static CapOptions UseNATS(this CapOptions options, string? bootstrapServers = null) | ||
{ | ||
/// <summary> | ||
/// Configuration to use NATS in CAP. | ||
/// </summary> | ||
/// <param name="options">CAP configuration options</param> | ||
/// <param name="bootstrapServers">NATS bootstrap server urls.</param> | ||
public static CapOptions UseNATS(this CapOptions options, string? bootstrapServers = null) | ||
return options.UseNATS(opt => | ||
{ | ||
return options.UseNATS(opt => | ||
{ | ||
if (bootstrapServers != null) | ||
opt.Servers = bootstrapServers; | ||
}); | ||
} | ||
if (bootstrapServers != null) | ||
opt.Servers = bootstrapServers; | ||
}); | ||
} | ||
|
||
/// <summary> | ||
/// Configuration to use NATS in CAP. | ||
/// </summary> | ||
/// <param name="options">CAP configuration options</param> | ||
/// <param name="configure">Provides programmatic configuration for the NATS.</param> | ||
/// <returns></returns> | ||
public static CapOptions UseNATS(this CapOptions options, Action<NATSOptions> configure) | ||
/// <summary> | ||
/// Configuration to use NATS in CAP. | ||
/// </summary> | ||
/// <param name="options">CAP configuration options</param> | ||
/// <param name="configure">Provides programmatic configuration for the NATS.</param> | ||
/// <returns></returns> | ||
public static CapOptions UseNATS(this CapOptions options, Action<NATSOptions> configure) | ||
{ | ||
if (configure == null) | ||
{ | ||
if (configure == null) | ||
{ | ||
throw new ArgumentNullException(nameof(configure)); | ||
} | ||
throw new ArgumentNullException(nameof(configure)); | ||
} | ||
|
||
options.RegisterExtension(new NATSCapOptionsExtension(configure)); | ||
options.RegisterExtension(new NATSCapOptionsExtension(configure)); | ||
|
||
return options; | ||
} | ||
return options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
// Copyright (c) .NET Core Community. All rights reserved. | ||
// Copyright (c) .NET Core Community. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using NATS.Client; | ||
|
||
namespace DotNetCore.CAP.NATS | ||
namespace DotNetCore.CAP.NATS; | ||
|
||
public interface IConnectionPool | ||
{ | ||
public interface IConnectionPool | ||
{ | ||
string ServersAddress { get; } | ||
string ServersAddress { get; } | ||
|
||
IConnection RentConnection(); | ||
IConnection RentConnection(); | ||
|
||
bool Return(IConnection connection); | ||
} | ||
bool Return(IConnection connection); | ||
} |
Oops, something went wrong.