0

I'm using Camel 2.18.1 and have a http4 route similar to

<to id="Http4Endpoint" uri="https4://{{servicename}}?sslContextParameters=mySslContext"/>

{{servicename}} is loaded via BridgePropertyPlaceholderConfigurer so that I can specify the endpoint in different environments.

The problem that I have just run into is that some of my test environments aren't https and the route fails as it seems to be trying to force https communication.

I've previously used jetty producers where you could specify http or https in {{ servicename }} and it auto-negotiated it however http4 seems to only allow the hostname:port.

How can I manage the localisation between different environments so that it will work with either a http or https endpoint?

Thanks

Karl
  • 23
  • 1
  • 5
  • 1
    Why not inject the entire uri parameters as a placeholder? – Souciance Eqdam Rashti Sep 04 '17 at 19:49
  • I will probably go down that path but then it does make it more difficult for the downstream deployment team. They don't necessarily understand what http(s)4 or the sslContextParameters are etc. – Karl Sep 06 '17 at 07:09
  • You could off course inject in via environment variables depending on some condition. But I did something similar and we injected the entire uri string instead. You could off course load it from a property file as well if you wanted. – Souciance Eqdam Rashti Sep 06 '17 at 07:31

1 Answers1

0

You can use more placeholders in the uri, so you can just have another option to configure if its http or https.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Hi Claus, My main issue with that is the loading of the ssl context. I only need that for ssl and if the ssl context is present then it seems to force it to https even if http4 is specified. I can use multiple placeholders to achieve this but it does start to add complexity to the properties file which makes it more difficult for the downstream deployment team – Karl Sep 06 '17 at 07:06