Skip to content

Commit a8609b9

Browse files
authored
Add option which controls whether topic is created on startup or not (#202)
1 parent e549aec commit a8609b9

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/ConductorSharp.Client/ConductorSharp.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Authors>Codaxy</Authors>
77
<Company>Codaxy</Company>
88
<PackageId>ConductorSharp.Client</PackageId>
9-
<Version>3.3.0</Version>
9+
<Version>3.4.0</Version>
1010
<Description>Client library for Netflix Conductor, with some additional quality of life features.</Description>
1111
<RepositoryUrl>https://github.com/codaxy/conductor-sharp</RepositoryUrl>
1212
<PackageTags>netflix;conductor</PackageTags>

src/ConductorSharp.Engine/ConductorSharp.Engine.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Authors>Codaxy</Authors>
77
<Company>Codaxy</Company>
88
<PackageId>ConductorSharp.Engine</PackageId>
9-
<Version>3.3.0</Version>
9+
<Version>3.4.0</Version>
1010
<Description>Client library for Netflix Conductor, with some additional quality of life features.</Description>
1111
<RepositoryUrl>https://github.com/codaxy/conductor-sharp</RepositoryUrl>
1212
<PackageTags>netflix;conductor</PackageTags>

src/ConductorSharp.KafkaCancellationNotifier/ConductorSharp.KafkaCancellationNotifier.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<Version>3.3.0</Version>
7+
<Version>3.4.0</Version>
88
<Authors>Codaxy</Authors>
99
<Company>Codaxy</Company>
1010
</PropertyGroup>

src/ConductorSharp.KafkaCancellationNotifier/Extensions/ExecutionManagerBuilderExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public static IExecutionManagerBuilder AddKafkaCancellationNotifier(
1111
this IExecutionManagerBuilder builder,
1212
string kafkaBootstrapServers,
1313
string topicName,
14-
string groupId
14+
string groupId,
15+
bool createTopicOnStartup = false
1516
)
1617
{
1718
ArgumentNullException.ThrowIfNull(kafkaBootstrapServers);
@@ -25,6 +26,7 @@ string groupId
2526
opts.BootstrapServers = kafkaBootstrapServers;
2627
opts.GroupId = groupId;
2728
opts.TopicName = topicName;
29+
opts.CreateTopicOnStartup = createTopicOnStartup;
2830
});
2931

3032
builder.Builder.AddSingleton<ICancellationNotifier, Service.KafkaCancellationNotifier>();
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
using System.ComponentModel.DataAnnotations;
2-
using Newtonsoft.Json;
1+
namespace ConductorSharp.KafkaCancellationNotifier;
32

4-
namespace ConductorSharp.KafkaCancellationNotifier
3+
internal class KafkaOptions
54
{
6-
internal class KafkaOptions
7-
{
8-
public string BootstrapServers { get; set; } = null!;
9-
public string TopicName { get; set; } = null!;
10-
public string GroupId { get; set; } = null!;
11-
}
5+
public string BootstrapServers { get; set; } = null!;
6+
public string TopicName { get; set; } = null!;
7+
public string GroupId { get; set; } = null!;
8+
public bool CreateTopicOnStartup { get; set; }
129
}

src/ConductorSharp.KafkaCancellationNotifier/Service/KafkaConsumerBackgroundService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ ICancellationNotifier notifier
5050

5151
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
5252
{
53-
await CreateTopicIfDoesNotExists();
53+
if (_kafkaOptions.Value.CreateTopicOnStartup)
54+
await CreateTopicIfDoesNotExists();
5455

5556
using var consumer = new ConsumerBuilder<string, TaskStatusModel>(
5657
new ConsumerConfig

src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
88
<Authors>Codaxy</Authors>
99
<Company>Codaxy</Company>
10-
<Version>3.3.0</Version>
10+
<Version>3.4.0</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>

0 commit comments

Comments
 (0)