Cleaned up request acks. Added internal service bus for internal messaging.
This commit is contained in:
31
Bus/ServiceBusObserver.cs
Normal file
31
Bus/ServiceBusObserver.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Reactive;
|
||||
using Serilog;
|
||||
|
||||
namespace TwitchChatTTS.Bus
|
||||
{
|
||||
public class ServiceBusObserver : ObserverBase<ServiceBusData>
|
||||
{
|
||||
private readonly Action<ServiceBusData> _action;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ServiceBusObserver(Action<ServiceBusData> action, ILogger logger)
|
||||
{
|
||||
_action = action;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected override void OnCompletedCore()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnErrorCore(Exception error)
|
||||
{
|
||||
_logger.Error(error, "Error occurred.");
|
||||
}
|
||||
|
||||
protected override void OnNextCore(ServiceBusData value)
|
||||
{
|
||||
_action.Invoke(value);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user