31 lines
737 B
C#
31 lines
737 B
C#
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);
|
|
}
|
|
}
|
|
} |