Skip to content

Commit

Permalink
Improve Producer and Consumer injection codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ifgris committed Jul 7, 2024
1 parent 79746c8 commit f81fc84
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Src/NanoRabbit/Connection/RabbitBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ public void EnableLogging(bool enableLogging)
_rabbitConfiguration.EnableLogging = enableLogging;
}

public void AddProducer(ProducerOptions options)
public void AddProducer(Action<ProducerOptions> configureProducer)
{
var options = new ProducerOptions();
configureProducer(options);
_rabbitConfiguration.Producers.Add(options);
}
public void AddConsumer(ConsumerOptions options)

public void AddConsumer(Action<ConsumerOptions> configureConsumer)
{
var options = new ConsumerOptions();
configureConsumer(options);
_rabbitConfiguration.Consumers.Add(options);
}

Expand All @@ -65,6 +69,8 @@ public RabbitConfiguration Build()
}
}



public static class ConfigurationExtensions
{
/// <summary>
Expand Down

0 comments on commit f81fc84

Please sign in to comment.