Mark van Renswoude
2755e93440
- Upgrade to .NET 5 - Split functionality into libraries - Tabbed interface for multiple subscribers - Placeholder for publishing tab
37 lines
772 B
C#
37 lines
772 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace PettingZoo.Core.Connection
|
|
{
|
|
public interface IConnection : IAsyncDisposable
|
|
{
|
|
event EventHandler<StatusChangedEventArgs> StatusChanged;
|
|
|
|
ISubscriber Subscribe(string exchange, string routingKey);
|
|
Task Publish(MessageInfo 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;
|
|
}
|
|
}
|
|
}
|