-
Notifications
You must be signed in to change notification settings - Fork 140
fix: move IMessageProducer and IProducerAccessor from main project to Abstractions #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Zananok
wants to merge
1
commit into
Farfetch:master
Choose a base branch
from
Zananok:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/KafkaFlow.Abstractions/Producers/IDeliveryReportFlow.cs
This file contains hidden or 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,27 @@ | ||
| namespace KafkaFlow; | ||
|
|
||
| /// <summary> | ||
| /// Transfer interface for the DeliveryReport in Confluent.Kafka | ||
| /// </summary> | ||
| /// <typeparam name="TKey"></typeparam> | ||
| /// <typeparam name="TValue"></typeparam> | ||
| public interface IDeliveryReportFlow<out TKey, out TValue> : IDeliveryResultFlow<TKey, TValue> | ||
| { | ||
| string Topic { get; } | ||
|
|
||
| int Partition { get; } | ||
|
|
||
| long Offset { get; } | ||
|
|
||
| IError Error { get; } | ||
|
|
||
| /// <summary> | ||
| /// Unused | ||
| /// </summary> | ||
| TKey Key { get; } | ||
|
|
||
| /// <summary> | ||
| /// Unused | ||
| /// </summary> | ||
| TValue Value { get; } | ||
| } | ||
29 changes: 29 additions & 0 deletions
29
src/KafkaFlow.Abstractions/Producers/IDeliveryResultFlow.cs
This file contains hidden or 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,29 @@ | ||
| using System; | ||
|
|
||
| namespace KafkaFlow; | ||
|
|
||
| /// <summary> | ||
| /// Transfer interface for the DeliveryResult in Confluent.Kafka | ||
| /// </summary> | ||
| /// <typeparam name="TKey"></typeparam> | ||
| /// <typeparam name="TValue"></typeparam> | ||
| public interface IDeliveryResultFlow<out TKey, out TValue> | ||
| { | ||
| string Topic { get; } | ||
|
|
||
| int Partition { get; } | ||
|
|
||
| long Offset { get; } | ||
|
|
||
| object Status { get; } | ||
|
|
||
| object Message { get; } | ||
|
|
||
| TKey Key { get; } | ||
|
|
||
| TValue Value { get; } | ||
|
|
||
| DateTime Timestamp { get; } | ||
|
|
||
| object Headers { get; } | ||
| } |
This file contains hidden or 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,15 @@ | ||
| namespace KafkaFlow; | ||
|
|
||
| /// <summary> | ||
| /// Transfer interface for the Error in Confluent.Kafka | ||
| /// </summary> | ||
| public interface IError | ||
| { | ||
| public bool IsError { get; } | ||
|
|
||
| public string Reason { get; } | ||
|
|
||
| public bool IsFatal { get; } | ||
|
|
||
| public object Code { get; } | ||
| } |
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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 hidden or 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 Confluent.Kafka; | ||
| using KafkaFlow.Producers; | ||
|
|
||
| namespace KafkaFlow; | ||
|
|
||
| /// <summary> | ||
| /// No needed | ||
| /// </summary> | ||
| public static class DeliveryReportExtension | ||
| { | ||
| /// <summary> | ||
| /// Converts a Confluent.Kafka delivery report to a KafkaFlow delivery report. | ||
| /// </summary> | ||
| /// <param name="report"></param> | ||
| /// <typeparam name="TKey"></typeparam> | ||
| /// <typeparam name="TValue"></typeparam> | ||
| /// <returns></returns> | ||
| public static IDeliveryReportFlow<TKey, TValue> ToIDeliveryReportFlow<TKey, TValue>(this DeliveryReport<TKey, TValue> report) | ||
| { | ||
| return new DeliveryReportFlow<TKey, TValue> | ||
| { | ||
| Topic = report.Topic, | ||
| Partition = report.Partition, | ||
| Offset = report.Offset, | ||
| Error = report.Error.ToIError(), | ||
| }; | ||
| } | ||
| } |
This file contains hidden or 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,34 @@ | ||
| using System; | ||
| using Confluent.Kafka; | ||
|
|
||
| namespace KafkaFlow.Producers; | ||
|
|
||
| /// <summary> | ||
| /// No needed | ||
| /// </summary> | ||
| public static class DeliveryResultExtension | ||
| { | ||
| /// <summary> | ||
| /// Converts a KafkaFlow delivery result to a Confluent.Kafka delivery result. | ||
| /// </summary> | ||
| /// <param name="deliveryResult"></param> | ||
| /// <typeparam name="TKey"></typeparam> | ||
| /// <typeparam name="TValue"></typeparam> | ||
| /// <returns></returns> | ||
| public static IDeliveryResultFlow<TKey, TValue> ToIDeliveryResultFlow<TKey, TValue>( | ||
| this DeliveryResult<TKey, TValue> deliveryResult) | ||
| { | ||
| return new DeliveryResultFlow<TKey, TValue> | ||
| { | ||
| Topic = deliveryResult.Topic, | ||
| Partition = deliveryResult.Partition, | ||
| Offset = deliveryResult.Offset, | ||
| Status = deliveryResult.Status, | ||
| Message = deliveryResult.Message, | ||
| Key = deliveryResult.Key, | ||
| Value = deliveryResult.Value, | ||
| Timestamp = deliveryResult.Timestamp.UtcDateTime, | ||
| Headers = deliveryResult.Headers, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or 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,19 @@ | ||
| using Confluent.Kafka; | ||
|
|
||
| namespace KafkaFlow.Producers; | ||
|
|
||
| /// <summary> | ||
| /// No needed | ||
| /// </summary> | ||
| public static class ErrorExtension | ||
| { | ||
| internal static Error ToError(this IError report) => new((ErrorCode)report.Code, report.Reason, report.IsFatal); | ||
|
|
||
| internal static IError ToIError(this Error report) => new ErrorFlow | ||
| { | ||
| Code = report.Code, | ||
| IsError = (int)report.Code != 0, | ||
| Reason = report.Reason, | ||
| IsFatal = report.IsFatal, | ||
| }; | ||
| } |
This file contains hidden or 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 Confluent.Kafka; | ||
| using KafkaFlow.Producers; | ||
|
|
||
| namespace KafkaFlow; | ||
|
|
||
| /// <summary> | ||
| /// No needed | ||
| /// </summary> | ||
| public static class IDeliveryReportFlowExtension | ||
| { | ||
| /// <summary> | ||
| /// Converts a Confluent.Kafka delivery report to a KafkaFlow delivery report. | ||
| /// </summary> | ||
| /// <param name="report"></param> | ||
| /// <typeparam name="TKey"></typeparam> | ||
| /// <typeparam name="TValue"></typeparam> | ||
| /// <returns></returns> | ||
| public static DeliveryReport<TKey, TValue> ToDeliveryReport<TKey, TValue>(this IDeliveryReportFlow<TKey, TValue> report) | ||
| { | ||
| return new DeliveryReport<TKey, TValue> | ||
| { | ||
| Topic = report.Topic, | ||
| Partition = report.Partition, | ||
| Offset = report.Offset, | ||
| Error = report.Error.ToError(), | ||
| }; | ||
| } | ||
| } |
This file contains hidden or 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,40 @@ | ||
| using System; | ||
| using Confluent.Kafka; | ||
|
|
||
| namespace KafkaFlow.Producers; | ||
|
|
||
| /// <summary> | ||
| /// No needed | ||
| /// </summary> | ||
| public static class IDeliveryResultFlowExtension | ||
| { | ||
| /// <summary> | ||
| /// Converts a Confluent.Kafka delivery result to a KafkaFlow delivery result. | ||
| /// </summary> | ||
| /// <param name="deliveryResult"></param> | ||
| /// <typeparam name="TKey"></typeparam> | ||
| /// <typeparam name="TValue"></typeparam> | ||
| /// <returns></returns> | ||
| /// <exception cref="ArgumentNullException"></exception> | ||
| public static DeliveryResult<TKey, TValue> ToDeliveryResult<TKey, TValue>( | ||
| this IDeliveryResultFlow<TKey, TValue> deliveryResult) | ||
| { | ||
| if (deliveryResult is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(deliveryResult)); | ||
| } | ||
|
|
||
| return new DeliveryResult<TKey, TValue> | ||
| { | ||
| Topic = deliveryResult.Topic, | ||
| Partition = deliveryResult.Partition, | ||
| Offset = deliveryResult.Offset, | ||
| Status = (PersistenceStatus)deliveryResult.Status, | ||
| Message = (Message<TKey, TValue>)deliveryResult.Message, | ||
| Key = deliveryResult.Key, | ||
| Value = deliveryResult.Value, | ||
| Timestamp = new Timestamp(deliveryResult.Timestamp), | ||
| Headers = (Headers)deliveryResult.Headers, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.