2021-11-28 13:18:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace PettingZoo.Core.Connection
|
|
|
|
|
{
|
|
|
|
|
public interface IConnection : IAsyncDisposable
|
|
|
|
|
{
|
|
|
|
|
event EventHandler<StatusChangedEventArgs> StatusChanged;
|
|
|
|
|
|
|
|
|
|
ISubscriber Subscribe(string exchange, string routingKey);
|
2021-12-06 13:08:29 +00:00
|
|
|
|
Task Publish(PublishMessageInfo messageInfo);
|
2021-11-28 13:18:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public enum ConnectionStatus
|
|
|
|
|
{
|
|
|
|
|
Disconnected,
|
|
|
|
|
Connecting,
|
|
|
|
|
Connected,
|
|
|
|
|
Error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class StatusChangedEventArgs : EventArgs
|
|
|
|
|
{
|
|
|
|
|
public ConnectionStatus Status { get; }
|
|
|
|
|
public string? Context { get; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public StatusChangedEventArgs(ConnectionStatus status, string? context)
|
|
|
|
|
{
|
|
|
|
|
Status = status;
|
|
|
|
|
Context = context;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|