2016-11-17 16:33:27 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2019-08-13 18:30:04 +00:00
|
|
|
|
using Tapeti.Config;
|
|
|
|
|
|
|
|
|
|
// ReSharper disable once UnusedMember.Global
|
2016-11-17 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
namespace Tapeti
|
2016-11-16 22:11:05 +00:00
|
|
|
|
{
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Allows publishing of messages.
|
|
|
|
|
/// </summary>
|
2016-11-16 22:11:05 +00:00
|
|
|
|
public interface IPublisher
|
|
|
|
|
{
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Publish the specified message. Transport details are determined by the Tapeti configuration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message">The message to send</param>
|
2016-11-17 16:33:27 +00:00
|
|
|
|
Task Publish(object message);
|
2016-11-16 22:11:05 +00:00
|
|
|
|
}
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
|
|
|
|
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <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>
|
2017-02-05 22:22:34 +00:00
|
|
|
|
public interface IInternalPublisher : IPublisher
|
2017-01-31 11:01:08 +00:00
|
|
|
|
{
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <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);
|
2017-01-31 11:01:08 +00:00
|
|
|
|
}
|
2016-11-16 22:11:05 +00:00
|
|
|
|
}
|