-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #411 from dotnetcore/dev
release v1.7.0
- Loading branch information
Showing
61 changed files
with
2,456 additions
and
550 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
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,24 +1,26 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<EasyCachingCorePackageVersion>1.6.1</EasyCachingCorePackageVersion> | ||
<EasyCachingMemcachedPackageVersion>1.6.1</EasyCachingMemcachedPackageVersion> | ||
<EasyCachingRedisPackageVersion>1.6.1</EasyCachingRedisPackageVersion> | ||
<EasyCachingSQLitePackageVersion>1.6.1</EasyCachingSQLitePackageVersion> | ||
<EasyCachingInMemoryPackageVersion>1.6.1</EasyCachingInMemoryPackageVersion> | ||
<EasyCachingHybridPackageVersion>1.6.1</EasyCachingHybridPackageVersion> | ||
<EasyCachingAspectCorePackageVersion>1.6.1</EasyCachingAspectCorePackageVersion> | ||
<EasyCachingCastlePackageVersion>1.6.1</EasyCachingCastlePackageVersion> | ||
<EasyCachingResponseCachingPackageVersion>1.6.1</EasyCachingResponseCachingPackageVersion> | ||
<EasyCachingJsonPackageVersion>1.6.1</EasyCachingJsonPackageVersion> | ||
<EasyCachingMessagePackPackageVersion>1.6.1</EasyCachingMessagePackPackageVersion> | ||
<EasyCachingProtobufPackageVersion>1.6.1</EasyCachingProtobufPackageVersion> | ||
<EasyCachingCSRedisPackageVersion>1.6.1</EasyCachingCSRedisPackageVersion> | ||
<EasyCachingRedisBusPackageVersion>1.6.1</EasyCachingRedisBusPackageVersion> | ||
<EasyCachingCSRedisBusPackageVersion>1.6.1</EasyCachingCSRedisBusPackageVersion> | ||
<EasyCachingRabbitBusPackageVersion>1.6.1</EasyCachingRabbitBusPackageVersion> | ||
<EasyCachingDiskPackageVersion>1.6.1</EasyCachingDiskPackageVersion> | ||
<EasyCachingMsExtPackageVersion>1.6.1</EasyCachingMsExtPackageVersion> | ||
<EasyCachingLiteDBPackageVersion>1.6.1</EasyCachingLiteDBPackageVersion> | ||
<EasyCachingSTJsonPackageVersion>1.6.1</EasyCachingSTJsonPackageVersion> | ||
<EasyCachingCorePackageVersion>1.7.0</EasyCachingCorePackageVersion> | ||
<EasyCachingMemcachedPackageVersion>1.7.0</EasyCachingMemcachedPackageVersion> | ||
<EasyCachingRedisPackageVersion>1.7.0</EasyCachingRedisPackageVersion> | ||
<EasyCachingSQLitePackageVersion>1.7.0</EasyCachingSQLitePackageVersion> | ||
<EasyCachingInMemoryPackageVersion>1.7.0</EasyCachingInMemoryPackageVersion> | ||
<EasyCachingHybridPackageVersion>1.7.0</EasyCachingHybridPackageVersion> | ||
<EasyCachingAspectCorePackageVersion>1.7.0</EasyCachingAspectCorePackageVersion> | ||
<EasyCachingCastlePackageVersion>1.7.0</EasyCachingCastlePackageVersion> | ||
<EasyCachingResponseCachingPackageVersion>1.7.0</EasyCachingResponseCachingPackageVersion> | ||
<EasyCachingJsonPackageVersion>1.7.0</EasyCachingJsonPackageVersion> | ||
<EasyCachingMessagePackPackageVersion>1.7.0</EasyCachingMessagePackPackageVersion> | ||
<EasyCachingProtobufPackageVersion>1.7.0</EasyCachingProtobufPackageVersion> | ||
<EasyCachingCSRedisPackageVersion>1.7.0</EasyCachingCSRedisPackageVersion> | ||
<EasyCachingRedisBusPackageVersion>1.7.0</EasyCachingRedisBusPackageVersion> | ||
<EasyCachingCSRedisBusPackageVersion>1.7.0</EasyCachingCSRedisBusPackageVersion> | ||
<EasyCachingRabbitBusPackageVersion>1.7.0</EasyCachingRabbitBusPackageVersion> | ||
<EasyCachingKafkaBusPackageVersion>1.7.0</EasyCachingKafkaBusPackageVersion> | ||
<EasyCachingZookeeperBusPackageVersion>1.7.0</EasyCachingZookeeperBusPackageVersion> | ||
<EasyCachingDiskPackageVersion>1.7.0</EasyCachingDiskPackageVersion> | ||
<EasyCachingMsExtPackageVersion>1.7.0</EasyCachingMsExtPackageVersion> | ||
<EasyCachingLiteDBPackageVersion>1.7.0</EasyCachingLiteDBPackageVersion> | ||
<EasyCachingSTJsonPackageVersion>1.7.0</EasyCachingSTJsonPackageVersion> | ||
</PropertyGroup> | ||
</Project> |
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
39 changes: 39 additions & 0 deletions
39
bus/EasyCaching.Bus.ConfluentKafka/Configurations/ConfluentKafkaBusOptions.cs
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Confluent.Kafka; | ||
|
||
namespace EasyCaching.Bus.ConfluentKafka | ||
{ | ||
/// <summary> | ||
/// kafka bus options | ||
/// </summary> | ||
public class ConfluentKafkaBusOptions | ||
{ | ||
/// <summary> | ||
/// kafka address(BootstrapServers must) | ||
/// </summary> | ||
public string BootstrapServers { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// kafka bus producer options. | ||
/// </summary> | ||
public ProducerConfig ProducerConfig { get; set; } | ||
|
||
/// <summary> | ||
/// kafka bus consumer options.(if GroupId value below is empty,then ConsumerConfig.GroupId must ) | ||
/// </summary> | ||
public ConsumerConfig ConsumerConfig { get; set; } | ||
|
||
/// <summary> | ||
/// kafka bus consumer options with consumer groupId | ||
/// (if ConsumerConfig below has give GroupId value , this options can ignore) | ||
/// import:if application is cluster,you should set this different value in application,this will make consumer can consumerdata | ||
/// </summary> | ||
public string GroupId { get; set; } | ||
|
||
/// <summary> | ||
/// kafka bus consumer consume count | ||
/// </summary> | ||
public int ConsumerCount { get; set; } = 1; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
bus/EasyCaching.Bus.ConfluentKafka/Configurations/ConfluentKafkaOptionsExtension.cs
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace EasyCaching.Bus.ConfluentKafka | ||
{ | ||
using System; | ||
using EasyCaching.Core.Bus; | ||
using EasyCaching.Core.Configurations; | ||
using EasyCaching.Core.Serialization; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
/// <summary> | ||
/// Kafka options extension. | ||
/// </summary> | ||
internal sealed class ConfluentKafkaOptionsExtension : IEasyCachingOptionsExtension | ||
{ | ||
|
||
private readonly Action<ConfluentKafkaBusOptions> _confluentKafkaBusOptions; | ||
|
||
public ConfluentKafkaOptionsExtension(Action<ConfluentKafkaBusOptions> confluentKafkaBusOptions) | ||
{ | ||
this._confluentKafkaBusOptions = confluentKafkaBusOptions; | ||
} | ||
|
||
/// <summary> | ||
/// Adds the services. | ||
/// </summary> | ||
/// <param name="services">Services.</param> | ||
public void AddServices(IServiceCollection services) | ||
{ | ||
services.AddOptions(); | ||
|
||
services.AddOptions<ConfluentKafkaBusOptions>() | ||
.Configure(_confluentKafkaBusOptions); | ||
|
||
|
||
//var options = services.BuildServiceProvider() | ||
// .GetRequiredService<IOptions<ConfluentKafkaBusOptions>>() | ||
// .Value; | ||
|
||
services.AddSingleton<IEasyCachingBus, DefaultConfluentKafkaBus>(); | ||
|
||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
bus/EasyCaching.Bus.ConfluentKafka/Configurations/EasyCachingOptionsExtensions.cs
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
using Confluent.Kafka; | ||
using EasyCaching.Bus.ConfluentKafka; | ||
using EasyCaching.Core; | ||
using EasyCaching.Core.Configurations; | ||
using Microsoft.Extensions.Configuration; | ||
using System; | ||
|
||
/// <summary> | ||
/// EasyCaching options extensions. | ||
/// </summary> | ||
public static class EasyCachingOptionsExtensions | ||
{ | ||
/// <summary> | ||
/// Withs the ConfluentKafka bus (specify the config via hard code). | ||
/// </summary> | ||
/// <param name="options"></param> | ||
/// <param name="configure"></param> | ||
/// <returns></returns> | ||
public static EasyCachingOptions WithConfluentKafkaBus( | ||
this EasyCachingOptions options | ||
, Action<ConfluentKafkaBusOptions> configure | ||
) | ||
{ | ||
ArgumentCheck.NotNull(configure, nameof(configure)); | ||
//option convert | ||
ConfluentKafkaBusOptions kafkaOptions = new ConfluentKafkaBusOptions(); | ||
configure.Invoke(kafkaOptions); | ||
void kafkaBusConfigure(ConfluentKafkaBusOptions x) | ||
{ | ||
x.BootstrapServers = kafkaOptions.BootstrapServers; | ||
x.ProducerConfig = kafkaOptions.ProducerConfig ?? new ProducerConfig(); | ||
x.ConsumerConfig = kafkaOptions.ConsumerConfig ?? new ConsumerConfig(); | ||
//address | ||
x.ProducerConfig.BootstrapServers = x.ProducerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers; | ||
x.ConsumerConfig.BootstrapServers = x.ConsumerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers; | ||
//consumer groupId | ||
x.ConsumerConfig.GroupId = x.ConsumerConfig.GroupId ?? kafkaOptions.GroupId; | ||
x.ConsumerConfig.AutoOffsetReset = kafkaOptions.ConsumerConfig.AutoOffsetReset ?? AutoOffsetReset.Latest; | ||
} | ||
|
||
options.RegisterExtension(new ConfluentKafkaOptionsExtension(kafkaBusConfigure)); | ||
return options; | ||
} | ||
|
||
/// <summary> | ||
/// Withs the ConfluentKafka bus (read config from configuration file). | ||
/// </summary> | ||
/// <param name="options"></param> | ||
/// <param name="configuration"></param> | ||
/// <param name="sectionName">The section name in the configuration file.</param> | ||
/// <returns></returns> | ||
public static EasyCachingOptions WithConfluentKafkaBus( | ||
this EasyCachingOptions options | ||
, IConfiguration configuration | ||
, string sectionName = EasyCachingConstValue.KafkaBusSection | ||
) | ||
{ | ||
var dbConfig = configuration.GetSection(sectionName); | ||
var kafkaOptions = new ConfluentKafkaBusOptions(); | ||
dbConfig.Bind(kafkaOptions); | ||
|
||
void configure(ConfluentKafkaBusOptions x) | ||
{ | ||
x.BootstrapServers = kafkaOptions.BootstrapServers; | ||
x.ProducerConfig = kafkaOptions.ProducerConfig ?? new ProducerConfig(); | ||
x.ConsumerConfig = kafkaOptions.ConsumerConfig ?? new ConsumerConfig(); | ||
//address | ||
x.ProducerConfig.BootstrapServers = x.ProducerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers; | ||
x.ConsumerConfig.BootstrapServers = x.ConsumerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers; | ||
//consumer groupId | ||
x.ConsumerConfig.GroupId = x.ConsumerConfig.GroupId ?? kafkaOptions.GroupId; | ||
x.ConsumerConfig.AutoOffsetReset = kafkaOptions.ConsumerConfig.AutoOffsetReset ?? AutoOffsetReset.Latest; | ||
} | ||
|
||
options.RegisterExtension(new ConfluentKafkaOptionsExtension(configure)); | ||
return options; | ||
} | ||
} | ||
} |
Oops, something went wrong.