35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
namespace Kbx.Shared.Integrations;
|
|
|
|
public enum KbxIntegrationDeliveryState { Queued, Delivering, Retrying, Delivered, Failed, Suspended }
|
|
public enum KbxIntegrationFailureKind { Transient, Permanent }
|
|
|
|
public sealed record KbxIntegrationMessage(
|
|
Guid MessageId,
|
|
Guid TenantId,
|
|
string IntegrationId,
|
|
string AggregateType,
|
|
string AggregateId,
|
|
long? AggregateVersion,
|
|
string Payload,
|
|
string CorrelationId,
|
|
DateTimeOffset CreatedAt);
|
|
|
|
public sealed record KbxIntegrationAttemptResult(
|
|
bool Succeeded,
|
|
KbxIntegrationFailureKind? FailureKind = null,
|
|
string? Code = null,
|
|
string? Detail = null,
|
|
int? HttpStatus = null,
|
|
string? ExternalReference = null);
|
|
|
|
public interface IKbxIntegrationAdapter
|
|
{
|
|
string IntegrationId { get; }
|
|
ValueTask<KbxIntegrationAttemptResult> SendAsync(KbxIntegrationMessage message, CancellationToken cancellationToken);
|
|
}
|
|
|
|
public interface IKbxIntegrationAdapterRegistry
|
|
{
|
|
IKbxIntegrationAdapter GetRequired(string integrationId);
|
|
}
|