Table of Contents

Interface ICommand<TCommand, TResponse, TEndPointDefinition>

Namespace
CarrotMQ.Core.Dto
Assembly
CarrotMQ.Core.dll

Represents a command interface that defines the contract for handling a specific command and its corresponding response sent over a specific endpoint (Exchange or Queue).

public interface ICommand<TCommand, TResponse, TEndPointDefinition> : _IRequest<TCommand, TResponse, TEndPointDefinition>, _IMessage<TCommand, TResponse, TEndPointDefinition>, _ICommand<TCommand, TResponse>, _IRequest<TCommand, TResponse>, _IMessage<TCommand, TResponse> where TCommand : ICommand<TCommand, TResponse, TEndPointDefinition> where TResponse : class where TEndPointDefinition : EndPointBase, new()

Type Parameters

TCommand

The type of the command.

TResponse

The type of the command response.

TEndPointDefinition

The type of the endpoint definition where the command will be sent to (should inherit from ExchangeEndPoint or QueueEndPoint).

Examples

Example of a command definition

public class ExecuteSomethingCmd : ICommand<ExecuteSomethingCmd, ExecuteSomethingCmd.Response, MyQueueEndPoint>
{
    public ExecuteSomethingCmd(string cmdData)
    {
        CmdData = cmdData;
    }

    public string CmdData { get; set; }


    public class Response
    {
        public bool Success { get; set; }
    }
}