liftbridge-io / java-liftbridge

Java client for Liftbridge. https://github.com/liftbridge-io/liftbridge
7 stars 1 forks source link

First pass changes #1

Closed tylertreat closed 4 years ago

tylertreat commented 4 years ago

Proposed changes after first pass through the code. Mostly minor syntax tweaks and API changes. Only major change is introducing a Builder class for creating Client instances. This will become more useful once the rest of the client options are implemented along with connection retries, pooling, etc.

I've been thinking about what the right API ergonomics are for "options", e.g. StreamOptions and SubscriptionOptions. In the Go client, we use the functional options pattern. In Java, the closest equivalent is probably the builder pattern, but that feels too "heavy" in a lot of cases, such as in the case of publishing. I thought about method overloading, but that quickly gets out of hand with all the different combinations of option parameters. It seems just having the *Options classes might be the best solution? I think using a Builder in the case of constructing a Client makes sense though.

@caioaao

caioaao commented 4 years ago

About the options: I saw the builder pattern for that but thought it was too clunky and preferred that options idiom. If you think of a better way to do so, please lmk :)