rabbitmq-java-client icon indicating copy to clipboard operation
rabbitmq-java-client copied to clipboard

ConnectionFactory: fluent style

Open rrrrrrrrramba opened this issue 7 years ago • 2 comments

It would be useful if the API of ConnectionFactory supported fluent style. For example:

Connection c = new ConnectionFactory().setUri(...).newConnection();
Connection c = new ConnectionFactory().load(...).newConnection();

Most of the times, this involves returning this in the setters.

I know this might be a personal opinion, but what do you think?

rrrrrrrrramba avatar Nov 09 '17 14:11 rrrrrrrrramba

Good idea. NioParams, introduced in 4.0, already uses a fluent API. This is a breaking change though, so it must be introduced in the next major release, that is 6.0.

acogoluegnes avatar Nov 09 '17 14:11 acogoluegnes

Great, thanks!

rrrrrrrrramba avatar Nov 09 '17 14:11 rrrrrrrrramba

Hey @acogoluegnes,

I feel like this might be a topic suited for an Open-Source beginner. Would you mind assigning this to me? I'd be eager to work on it.

Greetings, Ennio

enniokerber avatar May 20 '23 19:05 enniokerber

Thanks for contributing, @enniokerber. @acogoluegnes perhaps we can ship a small (source-level) backwards compatible like #1038 in 5.18?

michaelklishin avatar May 21 '23 07:05 michaelklishin

#1038 is not exactly a backward-compatible change: applications or libraries using reflection could depend on the method return type. This is very unlikely though, so I'd say we can backport this to 5.x. Is that OK with you @michaelklishin?

acogoluegnes avatar May 22 '23 07:05 acogoluegnes