RamblingCookieMonster / PSRabbitMq

PowerShell module to send and receive messages from a RabbitMq server
http://ramblingcookiemonster.github.io/RabbitMQ-Intro/
MIT License
47 stars 29 forks source link

Explicit Declaration of Exchange in Connect-RabbitMQChannel #16

Closed gaelcolas closed 7 years ago

gaelcolas commented 7 years ago

Hi,

I'm looking at addin an Active Declaration of basic exchanges (that is, non-autodelete, non-durable, and without any other fancy option) and would like your input.

The goal is to not need to create specific exchanges when consuming messages from a queue, so that we don't need to orchestrate the creation of the exchanges prior connecting a channel (No need to use RabbitMQTools before waiting for message for instance). Looking at the simplest signature: channel.ExchangeDeclare(exchangeName, ExchangeType.Direct);

I suggest that we:

Connect-RabbitMqChannel.ps1

#in param()
        [parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet('Direct','Fanout','Topic','Headers')]
        [string]$ExchangeType = $null,

# [...]
#Actively declare the Exchange (as non-autodelete, non-durable)
        if($ExchangeType -and [string]::Empty -ne $Exchange) {
            $ExchangeResult = $Channel.ExchangeDeclare($Exchange,$ExchangeType)
        }

Here's the link to my branch for a potential PR.

gaelcolas commented 7 years ago

This has been merged via #20, closing.