Re: host not found when using http4 in docker container
I don't see how that would help (and the links attribute is a legacy feature and not recommended). My situation is that the two containers are on the same network and can see each other. e.g. you can open a shell in one and ping the other using its hostname. So the networking at the container level is perfectly OK. The problem is that when using the HTTP4 camel component the same hostname does not get resolved. It looks like this is being done by the org.apache.http.impl.conn.SystemDefaultDnsResolver class in httpcomponents [1] which states in its docs: "DNS resolver that uses the default OS implementation for resolving host names." But it seems like it doesn't do this correctly? [1] https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/SystemDefaultDnsResolver.html On 06/06/18 04:35, Willem Jiang wrote: Can you add a link to the camel container just like this ? camel: image: "camel:0.3.0-SNAPSHOT" hostname: camel links: - "otherHost" - "zipkin:zipkin.io" Willem Jiang Twitter: willemjiang Weibo: 姜宁willem On Wed, Jun 6, 2018 at 4:40 AM, Tim Dudgeon wrote: On 05/06/18 20:40, Robin Vanderhallen wrote: Are both containers in the same network in the docker compose file? Yes. Both are in the same network environment, but this is not the default network. networks: - xxx Tim
Re: host not found when using http4 in docker container
OK, I think I worked out how to resolve this. It seems you need to have a `depends_on` property in the container that is posting the HTTP request. The service that is receiving the request need to be present in the `depends_on` otherwise Java cannot resolve the host names (even though the operating system can). e.g. in my case I needed to specify something like this: depends_on: coreservices: condition: service_healthy Clearly a Docker and Java thing, not really anything to do with Camel or the HTTP4 component. But very strange nonetheless! On 06/06/18 04:35, Willem Jiang wrote: Can you add a link to the camel container just like this ? camel: image: "camel:0.3.0-SNAPSHOT" hostname: camel links: - "otherHost" - "zipkin:zipkin.io" Willem Jiang Twitter: willemjiang Weibo: 姜宁willem On Wed, Jun 6, 2018 at 4:40 AM, Tim Dudgeon wrote: On 05/06/18 20:40, Robin Vanderhallen wrote: Are both containers in the same network in the docker compose file? Yes. Both are in the same network environment, but this is not the default network. networks: - xxx Tim
Swagger securityDefinition
Hi guys I’ve deployed Redhat SSO/ Key cloak and am successfully able to use it as a bearer-only client to verify tokens before executing webservices as defined by my restConfiguration What I would like to do next is extend the swagger doc that gets generated to include securityDefinitions for documentation purposes like this: "securityDefinitions":{ "petstore_auth":{ "type":"oauth2", "authorizationUrl":"http://petstore.swagger.io/oauth/dialog";, "flow":"implicit", "scopes":{ "write:pets":"modify pets in your account", "read:pets":"read your pets" } }, "api_key":{ "type":"apiKey", "name":"api_key", "in":"header" } } Example from http://petstore.swagger.io/ I see I am able to give the restConfig it’s own apiComponent but do not see how to get something like: Swagger swagger = new Swagger().info(info); swagger.securityDefinition("petstore_auth", new OAuth2Definition() .implicit("http://petstore.swagger.io/api/oauth/dialog";) .scope("read:pets", "read your pets") .scope("write:pets", "modify pets in your account")); Into the component Has anyone done something like this before? The only clues I have found online is that someone suggested extending camel-swagger-java to achieve this. A kick in the direction of how to do that will also be welcome Holding thumbs! Thanks Riaan Sent from Mail for Windows 10
Re: Swagger securityDefinition
Hi There is a JIRA ticket about adding security to camel-swagger-java https://issues.apache.org/jira/browse/CAMEL-9751 Contributions is welcome http://camel.apache.org/contributing On Wed, Jun 6, 2018 at 3:54 PM, Riaan Annandale wrote: > Hi guys > > I’ve deployed Redhat SSO/ Key cloak and am successfully able to use it as a > bearer-only client to verify tokens before executing webservices as defined > by my restConfiguration > > What I would like to do next is extend the swagger doc that gets generated to > include securityDefinitions for documentation purposes like this: >"securityDefinitions":{ > "petstore_auth":{ > "type":"oauth2", > "authorizationUrl":"http://petstore.swagger.io/oauth/dialog";, > "flow":"implicit", > "scopes":{ > "write:pets":"modify pets in your account", > "read:pets":"read your pets" > } > }, > "api_key":{ > "type":"apiKey", > "name":"api_key", > "in":"header" > } >} > > Example from http://petstore.swagger.io/ > > I see I am able to give the restConfig it’s own apiComponent but do not see > how to get something like: > Swagger swagger = new Swagger().info(info); > swagger.securityDefinition("petstore_auth", > new OAuth2Definition() > > .implicit("http://petstore.swagger.io/api/oauth/dialog";) > .scope("read:pets", "read your pets") > .scope("write:pets", "modify pets in your account")); > Into the component > > Has anyone done something like this before? The only clues I have found > online is that someone suggested extending camel-swagger-java to achieve > this. A kick in the direction of how to do that will also be welcome > > Holding thumbs! > > Thanks > Riaan > > > Sent from Mail for Windows 10 > -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Rép. : host not found when using http4 in docker container
try this start your docker witch --network=hostcoreservices then http4:hostcoreservices:8080/coreservices/rest/v1/services dont miss to add the hostcoreservices in you DNS Cliquer pour ajouter une signature ( gwsig:addsig) >>> I'm running camel inside a Docker container and trying to use the HTTP4 component to post a request to a service running in a different container (both containers are managed through Docker compose). Essentially I'm trying to do a post to a route like this: http4:coreservices:8080/coreservices/rest/v1/services where coreservices is the name of the other container. This fails with a java.net.UnknownHostException (see below). But the other container is definitely accessible from this container as if I open a shell in it I can the curl the 'coreservices' host. Any idea what's going wrong here? Thanks Tim 05-Jun-2018 17:09:34.667 SEVERE [localhost-startStop-1] org.apache.camel.util.CamelLogger.log Failed delivery for (MessageId: ID-4b81ce1e6383-46459-1528218572076-1-3 on ExchangeId: ID-4b81ce1e6383-46459-1528218572076-1-2). Exhausted after delivery attempt: 1 caught: java.net.UnknownHostException: coreservices: Name or service not known Message History --- RouteId ProcessorId Processor Elapsed (ms) [route6] [route6] [direct://post-service-descriptors ] [ 283] [route6] [log1 ] [log ] [ 5] [route6] [process1 ] [Processor@0xa8e9d5 ] [ 173] [route6] [to1 ] [http4:coreservices:8080/coreservices/rest/v1/services ] [95] Stacktrace --- java.net.UnknownHostException: coreservices: Name or service not known at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) at java.net.InetAddress.getAllByName0(InetAddress.java:1276) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:306) at org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:178) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197) at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197) at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97) at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529) at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:497) at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365) at org.apache.camel.impl.ProducerCache.sendExchange(Produce
FINAL REMINDER: Apache EU Roadshow 2018 in Berlin next week!
Hello Apache Supporters and Enthusiasts This is a final reminder that our Apache EU Roadshow will be held in Berlin next week on 13th and 14th June 2018. We will have 28 different sessions running over 2 days that cover some great topics. So if you are interested in Microservices, Internet of Things (IoT), Cloud, Apache Tomcat or Apache Http Server then we have something for you. https://foss-backstage.de/sessions/apache-roadshow We will be co-located with FOSS Backstage, so if you are interested in topics such as incubator, the Apache Way, open source governance, legal, trademarks or simply open source communities then there will be something there for you too. You can attend any of talks, presentations and workshops from the Apache EU Roadshow or FOSS Backstage. You can find details of the combined Apache EU Roadshow and FOSS Backstage conference schedule below: https://foss-backstage.de/schedule?day=2018-06-13 Ticket prices go up on 8th June 2018 and we have a last minute discount code that anyone can use before the deadline: 15% discount code: ASF15_discount valid until June 7, 23:55 CET You can register at the following link: https://foss-backstage.de/tickets Our Apache booth and lounge will be open from 11th - 14th June for meetups, hacking or to simply relax between sessions. And we will be posting regular updates on social media throughout next week so please follow us on Twitter @ApacheCon Thank you for your continued support and we look forward to seeing you in Berlin! Thanks Sharan Foga, VP Apache Community Development http://apachecon.com/ PLEASE NOTE: You are receiving this message because you are subscribed to a user@ or dev@ list of one or more Apache Software Foundation projects.