using System; using System.Threading.Tasks; // ReSharper disable UnusedMember.Global // ReSharper disable UnusedMemberInSuper.Global namespace Tapeti { /// /// /// public class ConnectedEventArgs { /// /// The connection parameters used to establish the connection. /// public TapetiConnectionParams ConnectionParams; /// /// The local port for the connection. Useful for identifying the connection in the management interface. /// public int LocalPort; } /// /// Contains information about the reason for a lost connection. /// public class DisconnectedEventArgs { /// /// The ReplyCode as indicated by the client library /// public ushort ReplyCode; /// /// The ReplyText as indicated by the client library /// public string ReplyText; } /// public delegate void ConnectedEventHandler(object sender, ConnectedEventArgs e); /// public delegate void DisconnectedEventHandler(object sender, DisconnectedEventArgs e); /// /// /// Represents a connection to a RabbitMQ server /// public interface IConnection : IDisposable { /// /// Creates a subscriber to consume messages from the bound queues. /// /// If true, the subscriber will start consuming messages immediately. If false, the queues will be /// declared but no messages will be consumed yet. Call Resume on the returned ISubscriber to start consuming messages. Task Subscribe(bool startConsuming = true); /// /// Synchronous version of Subscribe. /// /// If true, the subscriber will start consuming messages immediately. If false, the queues will be /// declared but no messages will be consumed yet. Call Resume on the returned ISubscriber to start consuming messages. ISubscriber SubscribeSync(bool startConsuming = true); /// /// Returns an IPublisher implementation for the current connection. /// /// IPublisher GetPublisher(); /// /// Closes the connection to RabbitMQ. /// Task Close(); /// /// Fired when a connection to RabbitMQ has been established. /// event ConnectedEventHandler Connected; /// /// Fired when the connection to RabbitMQ has been lost. /// event DisconnectedEventHandler Disconnected; /// /// Fired when the connection to RabbitMQ has been recovered after an unexpected disconnect. /// event ConnectedEventHandler Reconnected; } }