-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted config for better reusability. Reduced wait between queue c…
…hecks
- Loading branch information
1 parent
0bf5216
commit baffdff
Showing
7 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
source/OrderService/Messaging/IPublicationConfiguration.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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SummarisationSample.OrderService.Messaging | ||
{ | ||
|
||
/// <summary> | ||
/// Marker interface for classes implementing publication configuration | ||
/// </summary> | ||
public interface IPublicationConfiguration | ||
{ | ||
} | ||
} |
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,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SummarisationSample.OrderService.Messaging | ||
{ | ||
public interface IPublicationFactory | ||
{ | ||
IPublicationConfiguration GetPublicationConfiguration(string publicationName); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
source/OrderService/MessagingProviders/Kafka/KafkaPublicationConfiguration.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,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SummarisationSample.OrderService.Messaging.Kafka | ||
{ | ||
public class KafkaPublicationConfiguration : IPublicationConfiguration | ||
{ | ||
public string Topic { get; init; } = string.Empty; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
source/OrderService/MessagingProviders/Kafka/KafkaPublicationFactory.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,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SummarisationSample.OrderService.Messaging.Kafka | ||
{ | ||
public class KafkaPublicationFactory : IPublicationFactory | ||
{ | ||
/// <summary> | ||
/// Get the configuration for a named publication | ||
/// </summary> | ||
/// <param name="publicationName">The name of the publication for which config is required</param> | ||
/// <returns>The configuration for the publication named</returns> | ||
/// <exception cref="ArgumentNullException"></exception> | ||
public IPublicationConfiguration GetPublicationConfiguration(string publicationName) | ||
{ | ||
if (publicationName is null) throw new ArgumentNullException(nameof(publicationName)); | ||
|
||
// Only one publication for now; extend if required | ||
return new KafkaPublicationConfiguration() | ||
{ | ||
Topic = "summarisation.order" | ||
}; | ||
} | ||
} | ||
} |
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