WesternGun
WesternGun

Reputation: 12787

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:

Upvotes: 0

Views: 444

Answers (1)

geoand
geoand

Reputation: 64059

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

Upvotes: 5

Related Questions