1
0
mirror of synced 2024-11-15 01:33:51 +00:00
PettingZoo/PettingZoo.Core/Connection/IConnection.cs

39 lines
813 B
C#
Raw Permalink Normal View History

using System;
using System.Threading.Tasks;
namespace PettingZoo.Core.Connection
{
public interface IConnection : IAsyncDisposable
{
event EventHandler<StatusChangedEventArgs> StatusChanged;
ISubscriber Subscribe(string exchange, string routingKey);
ISubscriber Subscribe();
2021-12-06 13:08:29 +00:00
Task Publish(PublishMessageInfo messageInfo);
}
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;
}
}
}