Skip to content

Commit 0b69248

Browse files
committed
Refactor logging to use ConnectorLoggerEventId and improve connector initialization/authentication flow.
1 parent 3939c22 commit 0b69248

52 files changed

Lines changed: 2424 additions & 2981 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Deveel.Messaging.Connector.Abstractions/Messaging/ChannelConnectorBase.cs

Lines changed: 307 additions & 164 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace Deveel.Messaging;
2+
3+
public class ConnectorException : MessagingException
4+
{
5+
public ConnectorException(string errorCode) : base(errorCode)
6+
{
7+
}
8+
9+
public ConnectorException(string errorCode, string? message) : base(errorCode, message)
10+
{
11+
}
12+
13+
public ConnectorException(string errorCode, string? message, Exception? innerException) : base(errorCode, message, innerException)
14+
{
15+
}
16+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
namespace Deveel.Messaging;
2+
3+
internal static class ConnectorLoggerEventId
4+
{
5+
public const int StartingAuthentication = LoggerEventId.BaseId + 10;
6+
public const int NoAuthenticationConfigurationFound = LoggerEventId.BaseId + 11;
7+
public const int UsingAuthenticationConfiguration = LoggerEventId.BaseId + 12;
8+
public const int AuthenticationSuccessful = LoggerEventId.BaseId + 13;
9+
public const int AuthenticationFailed = LoggerEventId.BaseId + 14;
10+
public const int AuthenticationException = LoggerEventId.BaseId + 15;
11+
public const int NoCredentialToRefresh = LoggerEventId.BaseId + 16;
12+
public const int RefreshingAuthenticationCredential = LoggerEventId.BaseId + 17;
13+
public const int AuthenticationCredentialRefreshed = LoggerEventId.BaseId + 18;
14+
public const int AuthenticationCredentialRefreshFailed = LoggerEventId.BaseId + 19;
15+
public const int AuthenticationCredentialRefreshException = LoggerEventId.BaseId + 20;
16+
17+
public const int CheckingHealth = LoggerEventId.BaseId + 25;
18+
public const int HealthCheckSuccessful = LoggerEventId.BaseId + 26;
19+
public const int HealthCheckFailed = LoggerEventId.BaseId + 27;
20+
21+
public const int StateChanged = LoggerEventId.BaseId + 30;
22+
public const int InitializingConnector = LoggerEventId.BaseId + 31;
23+
public const int ConnectorInitialized = LoggerEventId.BaseId + 32;
24+
public const int ConnectorInitializationFailed = LoggerEventId.BaseId + 33;
25+
public const int ReadingStatus = LoggerEventId.BaseId + 34;
26+
public const int StatusRead = LoggerEventId.BaseId + 35;
27+
public const int StatusReadFailed = LoggerEventId.BaseId + 36;
28+
29+
public const int TestingConnection = LoggerEventId.BaseId + 40;
30+
public const int ConnectionTestSuccessful = LoggerEventId.BaseId + 41;
31+
public const int ConnectionTestFailed = LoggerEventId.BaseId + 43;
32+
33+
public const int ValidatingMessage = LoggerEventId.BaseId + 50;
34+
public const int MessageValidationFailed = LoggerEventId.BaseId + 51;
35+
public const int MessageValidationPassed = LoggerEventId.BaseId + 52;
36+
public const int BatchValidationFailed = LoggerEventId.BaseId + 53;
37+
38+
public const int ValidatingCapability = LoggerEventId.BaseId + 60;
39+
public const int CapabilityNotSupported = LoggerEventId.BaseId + 61;
40+
41+
public const int ValidatingOperationalState = LoggerEventId.BaseId + 71;
42+
public const int NotInOperationalState = LoggerEventId.BaseId + 72;
43+
44+
public const int SendingMessage = LoggerEventId.BaseId + 80;
45+
public const int MessageSent = LoggerEventId.BaseId + 81;
46+
public const int MessageSendFailed = LoggerEventId.BaseId + 82;
47+
public const int ReadingMessageStatus = LoggerEventId.BaseId + 83;
48+
public const int MessageStatusRead = LoggerEventId.BaseId + 84;
49+
public const int MessageStatusReadFailed = LoggerEventId.BaseId + 85;
50+
public const int SendingBatch = LoggerEventId.BaseId + 90;
51+
public const int BatchSent = LoggerEventId.BaseId + 91;
52+
public const int BatchSendFailed = LoggerEventId.BaseId + 92;
53+
54+
public const int ReceivingMessageStatus = LoggerEventId.BaseId + 100;
55+
public const int MessageStatusReceived = LoggerEventId.BaseId + 101;
56+
public const int MessageStatusReceiveFailed = LoggerEventId.BaseId + 102;
57+
58+
public const int ReceivingMessage = LoggerEventId.BaseId + 110;
59+
public const int MessageReceived = LoggerEventId.BaseId + 111;
60+
public const int MessageReceiveFailed = LoggerEventId.BaseId + 112;
61+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace Deveel.Messaging;
4+
5+
public class ConnectorValidationException : ConnectorException
6+
{
7+
public ConnectorValidationException(string errorCode, IReadOnlyList<ValidationResult> validationResults) : base(errorCode)
8+
{
9+
ValidationResults = validationResults;
10+
}
11+
12+
public ConnectorValidationException(string errorCode, string? message, IReadOnlyList<ValidationResult> validationResults) : base(errorCode, message)
13+
{
14+
ValidationResults = validationResults;
15+
}
16+
17+
/// <summary>
18+
/// Gets the collection of validation results.
19+
/// </summary>
20+
public IReadOnlyList<ValidationResult> ValidationResults { get; }
21+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using Microsoft.Extensions.Logging;
2+
3+
namespace Deveel.Messaging;
4+
5+
public static class LoggerEventId
6+
{
7+
public const int BaseId = 1001;
8+
}

0 commit comments

Comments
 (0)