michaelklishin/langohr

:port required with :ssl true

vincentjames501 opened this issue · 1 comments

Calling

(langohr.core/connect {:host "localhost" :ssl true})

Will fail if tls is enabled on the broker. It looks like the intention of the code was to use ConnectionFactory/DEFAULT_AMQP_OVER_SSL_PORT when :ssl is supplied, however, due to the call to normalize-settings, it will set :port to 5672 which when building the addresses to connect to will cause (get settings' :port default-port) to never return the default-port as it seems like was the intention:

settings'             (normalize-settings settings)
...
xs                    (address-array-from (get settings' :hosts #{})
                                                            (get settings' :port default-port))

You can get around this by manually supplying :port to the connection map but it was a bit of a gotcha as it was clearly trying to do ssl, the connection factory has the correct port defined, etc, but it was ultimately trying to connect on the non tls endpoint.

Please submit a PR?