Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Connection option for Consumer and Producer #149

Merged
merged 2 commits into from
Mar 9, 2020

Conversation

Shemeikka
Copy link
Contributor

Description

Added new keyword 'connection' to both Consumer's and Producer's inits.

This accepts same values as AMQP-library's Connection.open/2

Using 'connection' keyword instead of 'uri' tells user that more values than just the connection string can be passed.

This would be a better fix for issue #141

The actual behavior is same as with 'uri' keyword. No actual logic changes were made.

The old 'uri' keyword can still be used.

Examples

# Using just connection string
def init() do
      [
        queue: "gen_rmq_wf_in_queue",
        exchange: {:fanout, "gen_rmq_in_wf_exchange"},
        routing_key: "#",
        prefetch_count: "10",
        connection: "amqp://guest:guest@localhost:5672",
        queue_ttl: 1000
      ]

# Using more options
def init() do
      [
        queue: "gen_rmq_wf_in_queue",
        exchange: {:fanout, "gen_rmq_in_wf_exchange"},
        routing_key: "#",
        prefetch_count: "10",
        connection: [host: "localhost", port: 5672, username: "guest", password: "guest"],
        queue_ttl: 1000
      ]

Checklist

  • I have updated the documentation accordingly

Added new keyword 'connection' to both
Consumer's and Producer's inits.

This accepts same values AMQP-library's
Connection.open/2

'connection' keyword tells user that
more options than just the connection
string can be passed.

The actual behavior is same as with
'uri' keyword. No actual logic changes
were made.

The old 'uri' keyword can still be used.
@Shemeikka Shemeikka requested review from mkorszun and vorce as code owners March 8, 2020 11:56
@coveralls
Copy link

coveralls commented Mar 8, 2020

Coverage Status

Coverage increased (+0.09%) to 89.2% when pulling 82598c2 on Shemeikka:connection_opts into a6fe01f on meltwater:master.

Copy link
Collaborator

@vorce vorce left a comment

Choose a reason for hiding this comment

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

I like this a lot, thank you! Some small stuff I'd like to change.

Added link to AMQP-library's connection.open/2 for the connection-keyword.

Added small comment to publisher's parse_config.
@vorce vorce merged commit 62af78f into meltwater:master Mar 9, 2020
@vorce
Copy link
Collaborator

vorce commented Mar 9, 2020

Thanks a lot for the contribtion @Shemeikka

@Shemeikka Shemeikka deleted the connection_opts branch March 11, 2020 16:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants