You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by re...@bradleejohnson.com on 2019/11/06 21:44:09 UTC

Netty server issues...

I've been running into some issues with Netty shared server on Windows. The
production deployment is on Windows as well so this isn't just a minor
issue.

 

The Netty shared server is bootstrapped in a bundle and the interface is
being exported to the registry and is correctly being picked up from the
registry. 

 

5:15:05.910 INFO [Blueprint Event Dispatcher: 1] Netty consumer bound to:
0.0.0.0:8888
5:15:05.910 INFO [Blueprint Event Dispatcher: 1] Route: foo-info started and
consuming from: http://0.0.0.0:8888/foo/info?httpMethodRestrict=GET

 

 

The Camel DSL is being setup to use the server which is pulled from the
registry in Blueprint and it appears to wire up correctly. I can even use
@BeanInject to get the shared server and use that to set the port. 

 

I'll likely have 10 to N REST bundles that will be installed in a more less
microservices like fashion. The issue is that for this to work it appears I
have to set the host and the port in every single one of them instead of it
just taking the IP that is set in the shared server. That creates problems
in that Swagger report 0.0.0.0 as the IP address if it is not explicitly set
on the route. This is going to result in a lot of overhead and duplicate
configuration which is brittle to say the least. The shared Netty server
interface doesn't expose the host so I can't just pull it off there. 

 

Is there something I'm missing here or is there a way I can enable this to
get the correct IP address? If I hit the IP with the host:port/api-docs it
brings back the swagger. But if I use the plugin to query against it, it
attempts to query against 0.0.0.0:port unless I explicitly set it in the
restConfiguration() path. I was moving away from CXF to avoid this kind of
thing.

 

The bundles are setup in a microservices like fashion with a core of OSGi
service connectors that are used by pretty much everyone along with the
requisite Camel libraries and a shared Netty server bundle. So any given
instance of Karaf might have 0.N REST bundles installed as necessary and
having to have multiple configurations for this isn't going to work. 

 

I may just be missing something or there may be a better short cut but I'm
not sure what it would be as I'm not as familiar with the Camel REST routes.


 

restConfiguration().component("netty4-http")

 
.endpointProperty("nettySharedHttpServer","#sharedNettyHttpServer")

 
.bindingMode(RestBindingMode.auto)

 
.dataFormatProperty("prettyPrint", "true")

                                               .host("{{host}}")

                                               .port("{{port}}")

                                               .apiContextPath("/api-doc") 

 
.apiProperty("api.title", "Trust Member API")

 
.apiProperty("api.version", "1.1")

                                                               // and enable
CORS

 
.apiProperty("cors", "true");