-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PoC: Include event-based instrumentation
- Loading branch information
1 parent
b1a91d0
commit 1ccaea9
Showing
19 changed files
with
255 additions
and
50 deletions.
There are no files selected for viewing
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
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
14 changes: 14 additions & 0 deletions
14
src/KafkaFlow.Abstractions/Events/Args/ConsumeErrorEventArgs.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,14 @@ | ||
using System; | ||
|
||
namespace KafkaFlow.Events.Args | ||
{ | ||
public class ConsumeErrorEventArgs | ||
{ | ||
public ConsumeErrorEventArgs(Exception exception) | ||
{ | ||
this.Exception = exception; | ||
} | ||
|
||
public Exception Exception { get; set; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/KafkaFlow.Abstractions/Events/Args/ConsumeStartEventArgs.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,12 @@ | ||
namespace KafkaFlow.Events.Args | ||
{ | ||
public class ConsumeStartEventArgs | ||
{ | ||
internal ConsumeStartEventArgs(IMessageContext context) | ||
{ | ||
this.MessageContext = context; | ||
} | ||
|
||
public IMessageContext MessageContext { get; set; } | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/KafkaFlow.Abstractions/Events/Args/ProduceErrorEventArgs.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,14 @@ | ||
using System; | ||
|
||
namespace KafkaFlow.Events.Args | ||
{ | ||
public class ProduceErrorEventArgs | ||
{ | ||
public ProduceErrorEventArgs(Exception exception) | ||
{ | ||
this.Exception = exception; | ||
} | ||
|
||
public Exception Exception { get; set; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/KafkaFlow.Abstractions/Events/Args/ProduceStartEventArgs.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,12 @@ | ||
namespace KafkaFlow.Events.Args | ||
{ | ||
public class ProduceStartEventArgs | ||
{ | ||
internal ProduceStartEventArgs(IMessageContext context) | ||
{ | ||
this.MessageContext = context; | ||
} | ||
|
||
public IMessageContext MessageContext { get; set; } | ||
} | ||
} |
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,36 @@ | ||
using System; | ||
using KafkaFlow.Events.Args; | ||
|
||
namespace KafkaFlow.Events | ||
{ | ||
public class EventsManager : IEventsListener, IEventsNotifier | ||
{ | ||
public event EventHandler<ConsumeStartEventArgs> OnConsumeStart; | ||
|
||
public event EventHandler<ProduceStartEventArgs> OnProduceStart; | ||
|
||
public event EventHandler<ConsumeErrorEventArgs> OnConsumeError; | ||
|
||
public event EventHandler<ProduceErrorEventArgs> OnProduceError; | ||
|
||
public void NotifyOnConsumeError(Exception exception) | ||
{ | ||
this.OnConsumeError?.Invoke(this, new ConsumeErrorEventArgs(exception)); | ||
} | ||
|
||
public void NotifyOnConsumeStart(IMessageContext context) | ||
{ | ||
this.OnConsumeStart?.Invoke(this, new ConsumeStartEventArgs(context)); | ||
} | ||
|
||
public void NotifyOnProduceError(Exception exception) | ||
{ | ||
this.OnProduceError?.Invoke(this, new ProduceErrorEventArgs(exception)); | ||
} | ||
|
||
public void NotifyOnProduceStart(IMessageContext context) | ||
{ | ||
this.OnProduceStart?.Invoke(this, new ProduceStartEventArgs(context)); | ||
} | ||
} | ||
} |
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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using KafkaFlow.Events.Args; | ||
|
||
namespace KafkaFlow.Events | ||
{ | ||
public interface IEventsListener | ||
{ | ||
event EventHandler<ConsumeStartEventArgs> OnConsumeStart; | ||
|
||
event EventHandler<ProduceStartEventArgs> OnProduceStart; | ||
|
||
event EventHandler<ConsumeErrorEventArgs> OnConsumeError; | ||
|
||
event EventHandler<ProduceErrorEventArgs> OnProduceError; | ||
} | ||
} |
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,18 @@ | ||
using System; | ||
|
||
namespace KafkaFlow.Events | ||
{ | ||
// Isto devia ser internal visto que a notificação de events não deveria ser publica, apenas a subscrição desses eventos | ||
|
||
// Falta o OnConsumeEnd e OnProduceEnd | ||
public interface IEventsNotifier | ||
{ | ||
void NotifyOnConsumeError(Exception exception); | ||
|
||
void NotifyOnConsumeStart(IMessageContext context); | ||
|
||
void NotifyOnProduceError(Exception exception); | ||
|
||
void NotifyOnProduceStart(IMessageContext context); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/KafkaFlow.Admin.Dashboard/Properties/launchSettings.json
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,12 @@ | ||
{ | ||
"profiles": { | ||
"KafkaFlow.Admin.Dashboard": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:57596;http://localhost:57597" | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.