Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add the ssl_options as new options for AMQP client #138

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeffhsta
Copy link

@jeffhsta jeffhsta commented Feb 7, 2025

No description provided.

@@ -301,6 +310,16 @@ defmodule BroadwayRabbitMQ.AmqpClient do
Connection.close(channel.conn)
end

defp open_connection_instrumented(%{connection: connection} = config) when is_binary(connection) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this separate branch? Also, could we pass all options forward, instead of only ssl_options?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function can be a bit confusing, but what I am seeing is that AMQP.Connection.open can receive a URL or Keyword with host, username, password and etc.

So this branch is to make it work two scenarios:

  1. Url is string, so we call AMQP.Connection.open/2 passing url and options
  2. connection is a Keyword, so AMQP.Connection.open/1 is called.

Maybe for scenario 2 I can append the ssl options, but I see it already expects it as part of the possible options schema

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other words, ssl_options are already supported if you pass a keyword list? Maybe you should pass a keyword list then and document this behaviour?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory yes, I will test that to make sure It works as I am expecting it to.

required: false,
doc: """
Defined the SSL settings for the connection with RabbitMQ.
Check `AMQP.Connection.open/2` for the full list of SSL options.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Check `AMQP.Connection.open/2` for the full list of SSL options.
This is the same as `:ssl_options` passed to `AMQP.Connection.open/2`.

type: :any,
required: false,
doc: """
Defined the SSL settings for the connection with RabbitMQ.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Defined the SSL settings for the connection with RabbitMQ.
SSL settings for the connection with RabbitMQ.

broadway: [type: :any, doc: false],
ssl_options: [
type: :any,
required: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary.

Suggested change
required: false,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants