pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
747 stars 144 forks source link

Seperate Queue Declare / Exchange Declare from Consumer Config #154

Closed pardahlman closed 7 years ago

pardahlman commented 8 years ago

The new ConsumeConfiguration looks like this

public class ConsumeConfiguration
{
    public QueueConfiguration Queue { get; set; }
    public ExchangeConfiguration Exchange { get; set; }
    public bool NoAck { get; set; }
    public string ConsumerTag { get; set; }
    public string RoutingKey { get; set; }
    public bool NoLocal { get; set; }
    public ushort PrefetchCount { get; set; }
    public bool Exclusive { get; set; }
    public Dictionary<string, object> Arguments { get; set; }
}

Where Queue and Exchange contains information about types, durability etc. The ConsumerConfiguration should only contain properties for performing the consume. That is, Queue should be replaces with the string QueueName.

The fluent configuration builder should be updated to something like this

cfg => cfg
    .OnExchange("")
    .FromQueue("my_queue")
    .WithRoutingKey("herllo")

But still support declaring exchanges and queues

cfg => cfg
    .OnDeclaredExchange(e => e
        .WithName("my_exchange")
        .WithType(ExchangeType.Topic))
    .FromDeclaredQueue(q => q
        .WithName("my_queue")
        .WithAutoDelete())
    .WithRoutingKey("herllo")
    .WithPrefetchCount(50)