1
0
mirror of synced 2024-09-28 19:56:09 +00:00
Tapeti/Tapeti/IPublisher.cs
Mark van Renswoude f8fca5879c [ci skip] Major refactoring for 2.0
- 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
2019-08-13 20:30:04 +02:00

51 lines
2.0 KiB
C#

using System.Threading.Tasks;
using Tapeti.Config;
// ReSharper disable once UnusedMember.Global
namespace Tapeti
{
/// <summary>
/// Allows publishing of messages.
/// </summary>
public interface IPublisher
{
/// <summary>
/// Publish the specified message. Transport details are determined by the Tapeti configuration.
/// </summary>
/// <param name="message">The message to send</param>
Task Publish(object message);
}
/// <inheritdoc />
/// <summary>
/// Low-level publisher for Tapeti internal use.
/// </summary>
/// <remarks>
/// Tapeti assumes every implementation of IPublisher can also be cast to an IInternalPublisher.
/// The distinction is made on purpose to trigger code-smells in non-Tapeti code when casting.
/// </remarks>
public interface IInternalPublisher : IPublisher
{
/// <summary>
/// Publishes a message. The exchange and routing key are determined by the registered strategies.
/// </summary>
/// <param name="message">An instance of a message class</param>
/// <param name="properties">Metadata to include in the message</param>
/// <param name="mandatory">If true, an exception will be raised if the message can not be delivered to at least one queue</param>
Task Publish(object message, IMessageProperties properties, bool mandatory);
/// <summary>
/// Publishes a message directly to a queue. The exchange and routing key are not used.
/// </summary>
/// <param name="message">An instance of a message class</param>
/// <param name="queueName">The name of the queue to send the message to</param>
/// <param name="properties">Metadata to include in the message</param>
/// <param name="mandatory">If true, an exception will be raised if the message can not be delivered to the queue</param>
/// <returns></returns>
Task PublishDirect(object message, string queueName, IMessageProperties properties, bool mandatory);
}
}