jakubkulhan / bunny

Performant pure-PHP AMQP (RabbitMQ) sync/async (ReactPHP) library
MIT License
698 stars 101 forks source link

Add support for setting client properties #132

Closed jeromegamez closed 3 months ago

jeromegamez commented 1 year ago

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.

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 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:

SimonSerrano commented 1 year ago

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

jeromegamez commented 1 year ago

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

jeromegamez commented 3 months ago

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 🤔

WyriHaximus commented 3 months ago

@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.

jeromegamez commented 3 months ago

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

jeromegamez commented 3 months ago

Should I target master or 0.6.x?

Update: Nevermind, sorry!