Mark van Renswoude
f8fca5879c
- Compiles, but that's about it. Plenty of ToDo's left before it will run. Beware, ye who enter here. - Cleanup of the internals, with the aim to keep the interface to application code compatible - Added the ability to declare durable queues on startup and update the bindings - Possibly fixed an issue with publish timeouts being logged after a reconnect
81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
// ReSharper disable UnusedMember.Global
|
|
|
|
namespace Tapeti
|
|
{
|
|
/// <summary>
|
|
/// Contains information about the reason for a lost connection.
|
|
/// </summary>
|
|
public class DisconnectedEventArgs
|
|
{
|
|
/// <summary>
|
|
/// The ReplyCode as indicated by the client library
|
|
/// </summary>
|
|
public ushort ReplyCode;
|
|
|
|
/// <summary>
|
|
/// The ReplyText as indicated by the client library
|
|
/// </summary>
|
|
public string ReplyText;
|
|
}
|
|
|
|
|
|
/// <inheritdoc />
|
|
public delegate void DisconnectedEventHandler(object sender, DisconnectedEventArgs e);
|
|
|
|
|
|
/// <inheritdoc />
|
|
/// <summary>
|
|
/// Represents a connection to a RabbitMQ server
|
|
/// </summary>
|
|
public interface IConnection : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Creates a subscriber to consume messages from the bound queues.
|
|
/// </summary>
|
|
/// <param name="startConsuming">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.</param>
|
|
Task<ISubscriber> Subscribe(bool startConsuming = true);
|
|
|
|
|
|
/// <summary>
|
|
/// Synchronous version of Subscribe.
|
|
/// </summary>
|
|
/// <param name="startConsuming">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.</param>
|
|
ISubscriber SubscribeSync(bool startConsuming = true);
|
|
|
|
|
|
/// <summary>
|
|
/// Returns an IPublisher implementation for the current connection.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
IPublisher GetPublisher();
|
|
|
|
|
|
/// <summary>
|
|
/// Closes the connection to RabbitMQ.
|
|
/// </summary>
|
|
Task Close();
|
|
|
|
|
|
/// <summary>
|
|
/// Fired when a connection to RabbitMQ has been established.
|
|
/// </summary>
|
|
event EventHandler Connected;
|
|
|
|
/// <summary>
|
|
/// Fired when the connection to RabbitMQ has been lost.
|
|
/// </summary>
|
|
event DisconnectedEventHandler Disconnected;
|
|
|
|
/// <summary>
|
|
/// Fired when the connection to RabbitMQ has been recovered after an unexpected disconnect.
|
|
/// </summary>
|
|
event EventHandler Reconnected;
|
|
|
|
}
|
|
}
|