using System.Data;
using System.Threading.Tasks;
namespace DotNetCore.CAP
{
///
/// A publish service for publish a message to CAP.
///
public interface ICapPublisher
{
///
/// Publish a string message to specified topic.
///
/// If you are using the EntityFramework, you need to configure the DbContextType first.
/// otherwise you need to use overloaded method with IDbConnection and IDbTransaction.
///
///
/// the topic name or exchange router key.
/// message body content.
Task PublishAsync(string name, string content);
///
/// Publis a object message to specified topic.
///
/// If you are using the EntityFramework, you need to configure the DbContextType first.
/// otherwise you need to use overloaded method with IDbConnection and IDbTransaction.
///
///
/// The type of conetent object.
/// the topic name or exchange router key.
/// object instance that will be serialized of json.
Task PublishAsync(string name, T contentObj);
///
/// Publish a string message to specified topic with transacton.
///
/// the topic name or exchange router key.
/// message body content.
/// the dbConnection of
Task PublishAsync(string name, string content, IDbConnection dbConnection);
///
/// Publish a string message to specified topic with transacton.
///
/// the topic name or exchange router key.
/// message body content.
/// the connection of
/// the transaction of
Task PublishAsync(string name, string content, IDbConnection dbConnection, IDbTransaction dbTransaction);
}
}