quarkusquarkus-rest-client

Quarkus rest client: how to combine leveled rest client config in YAML config


I am using Quarkus rest client and I already have congis in YAML like:

quarkus:
  rest-client:
    my-api:
      url: ${api.url}
      scope: javax.inject.Singleton
      connection-pool-size: 20

Now I want to add mp-rest/readTimeout and mp-rest/connectTimeout as per How to configure rest client in quarkus microprofile case

How should I put them? Should camel case be converted to hyphen cased?

Like this?

quarkus:
  rest-client:
    my-api:
      url: ${api.url}
      scope: javax.inject.Singleton
      connection-pool-size: 20
      mp-rest/readTimeout: 5000
      mp-rest/connectTimeout: 5000

or:

quarkus:
  rest-client:
    my-api:
      url: ${api.url}
      scope: javax.inject.Singleton
      connection-pool-size: 20
      mp-rest: 
        read-timeout: 5000
        connect-timeout: 5000

BTW why YAML format is not mentioned in doc? I don't know other people but I always prefer YAML and I don't like the doc only preferring .properties format, also I was searching in the Github repo but found no example in YAML. The conversion from properties format to YAML, in many cases, is not trivial.

For me, what is ideal is:


Solution

  • You don't need to use the /mp-rest at all.

    You can just use:

    quarkus:
      rest-client:
        my-api:
          url: ${api.url}
          scope: javax.inject.Singleton
          connection-pool-size: 20
          read-timeout: 5000
          connect-timeout: 5000
    

    See this for more details