jillesvangurp / kt-search

Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.
MIT License
107 stars 23 forks source link

[FEAT] Support netty/armeria client #85

Closed Dogacel closed 1 year ago

Dogacel commented 1 year ago

Describe the enhancement

Support a rest client other than Ktor such as Netty or Armeria.

Why is this needed?

We don't want to depend on Ktor when we already have dependencies on Netty and Armeria.

How do you think it should be done?

Should be a simple implementation. I think we should either pack it as a several jar or assume those two clients are runtime libraries.

Will you be able to help with a pull request?

Yes, I am willing to but first want to hear from the author about this request.

jillesvangurp commented 1 year ago

Interesting. I would suggest making this an independent library. Basically, all you have to do is implement RestClient and you should be able to use it with the SearchClient. This is exactly why I added support for this. I'd like to keep this out of the main repository though.

Alternatively, you could configure ktor client to use your existing client: https://ktor.io/docs/http-client-engines.html#limitations. I'm not familiar with Armeria but they have jetty and a few other client backends.

My current implementation defaults to the Java httpclient on the JVM. But there several other engines that you can configure. We had some issues with CIO a few months ago.

Dogacel commented 1 year ago

Interesting. I would suggest making this an independent library. Basically, all you have to do is implement RestClient and you should be able to use it with the SearchClient. This is exactly why I added support for this. I'd like to keep this out of the main repository though.

Alternatively, you could configure ktor client to use your existing client: https://ktor.io/docs/http-client-engines.html#limitations. I'm not familiar with Armeria but they have jetty and a few other client backends.

Because it is an api dependency inside the search-client, it is exposed to library consumers, which worries me.

My current implementation defaults to the Java httpclient on the JVM. But there several other engines that you can configure. We had some issues with CIO a few months ago.

I don't get it, isn't Ktor shipped with this library by default?

jillesvangurp commented 1 year ago

I can change the dependency to implementation if you want. That should solve the problem.

jillesvangurp commented 1 year ago

I fixed the dependencies in 2.1.2