bunny icon indicating copy to clipboard operation
bunny copied to clipboard

Add support for setting client properties

Open jeromegamez opened this issue 2 years ago • 2 comments

Hey there 👋!

Thank you for providing this library, I'm currently trying it out by porting an existing worker to it and enjoying the experience so far!

One feature I was missing was setting client properties and capabilities, for example, to provide a connection name to more easily identify connections to a server.

  • https://www.rabbitmq.com/connections.html#capabilities
  • https://www.rabbitmq.com/connections.html#client-provided-names

Enabling Bunny to set client properties is what I'd like to propose with this PR.

$connection = [
    'host'              => 'HOSTNAME',
    'vhost'             => 'VHOST',    // The default vhost is /
    'user'              => 'USERNAME', // The default user is guest
    'password'          => 'PASSWORD', // The default password is guest
    'client_properties' => [
        'connection_name' => 'It works!,
    ],
];
Without connection name With connection name
without_connection_name with_connection_name

I'd appreciate your feedback! I looked if there was a meaningful way to add a test for this, but I'm honestly not sure how to prove that the connection name really is set - all I have are the screenshots above and my word 😅.

I'd appreciate your feedback and am happy to make the needed adjustments to make a merge possible.

:octocat:

jeromegamez avatar Jan 27 '23 22:01 jeromegamez

Hello, we actually need that feature. This is quite a small change, @jakubkulhan can you take a look, merge and publish a new version ?

SimonSerrano avatar Sep 05 '23 12:09 SimonSerrano

I rebased the feature branch with the latest main branch to make sure the changes can still be applied 💪🏻

jeromegamez avatar Sep 05 '23 12:09 jeromegamez

Gentle ping @WyriHaximus 🙏🏻, I just rebased the branch again.

I also looked at the 0.6 branch, but I'd first have to find my way to see how I could add this there, if it's even needed 🤔

jeromegamez avatar May 10 '24 22:05 jeromegamez

@jeromegamez Thanks for the PR and nudge. I'll have a look at it tomorrow. Been using similar features to add information like pod name to consumers, so I fully welcome and support these features added to Bunny. As for 0.6, lets get it in 0.5 first before adding it to 0.6. 0.6 is a massive internal change from 0.6, but I love that you mention it.

WyriHaximus avatar May 10 '24 23:05 WyriHaximus

I'll definitely try, but I have to admit, 0.6 isn't easy for me to grasp 🙈. But don't tell me!

jeromegamez avatar May 19 '24 21:05 jeromegamez

Should I target master or 0.6.x?

Update: Nevermind, sorry!

jeromegamez avatar May 19 '24 22:05 jeromegamez