camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Soto <alex.s...@envieta.com>
Subject Using shared Netty configuration with Rest DSL
Date Thu, 21 May 2015 19:05:53 GMT
I would like to reuse the same Netty Service that is configured outside of the Rest DSL.  For
example I have the Netty and SSL configuration:


<camel:sslContextParameters id="sslParams">
 <camel:keyManagers keyPassword="changeit">
   <camel:keyStore resource="{{env:HOME}}/localhost.jks" password="changeit" type="JKS"
provider="SUN"/>
 </camel:keyManagers>
 <camel:trustManagers>
   <camel:keyStore resource="{{env:HOME}}/localhost.jks" password="changeit" type="JKS"
provider="SUN"/>
 </camel:trustManagers>
</camel:sslContextParameters>

<bean id="configuration" class="org.apache.camel.component.netty4.http.NettySharedHttpServerBootstrapConfiguration">
   <property name="port" value="8890"/>
   <property name="host" value="0.0.0.0"/>
   <property name="backlog" value="50"/>
   <property name="sslContextParameters" ref="sslParams"/>
   <property name="ssl" value="true"/>
</bean>

<bean id="sharedNettyHttpServer" class="org.apache.camel.component.netty4.http.DefaultNettySharedHttpServer"
init-method="start" destroy-method="stop">
   <property name="nettyServerBootstrapConfiguration" ref="configuration"/>
</bean>


Now in my Camel Context I declare the Rest DSL:


<camelContext id="camel-context-name" trace="true" xmlns="http://camel.apache.org/schema/spring
<http://camel.apache.org/schema/spring>">

 <restConfiguration component="netty4-http" > 
 	  <camel:componentProperty key="nettySharedHttpServer" value="#sharedNettyHttpServer"/>
	  <componentProperty key="nettyServerBootstrapConfiguration" value="#configuration"/>
 	  <camel:endpointProperty key="nettyServerBootstrapConfiguration" value="#configuration"/>
 </restConfiguration>
    	  
 <rest path="/customers/">
 	<get uri="/{id}">
	    <to uri="direct:getCustomers"/>
	</get>
	<get uri="/{id}/orders">
	    <to uri="direct:getCustomerOrders"/>
	</get>
	<post uri="/neworder">
	    <to uri="direct:newOrder"/>
	</post>
</rest>


However, it does not seem to be picking up the shared configuration.  Log file shows:

BootstrapFactory on port 0 is using bootstrap configuration: [NettyServerBootstrapConfiguration{protocol='tcp',
host=‘XXXXX.local', port=0, broadcast=false, sendBufferSize=65536, receiveBufferSize=65536,
receiveBufferSizePredictor=0, workerCount=0, bossCount=1, keepAlive=true, tcpNoDelay=true,
reuseAddress=true, connectTimeout=10000, backlog=0, serverInitializerFactory=org.apache.camel.component.netty4.http.HttpServerInitializerFactory@2db0d008,
nettyServerBootstrapFactory=null, options=null, ssl=false, sslHandler=null, sslContextParameters='null',
needClientAuth=false, enabledProtocols='TLSv1,TLSv1.1,TLSv1.2, keyStoreFile=null, trustStoreFile=null,
keyStoreResource='null', trustStoreResource='null', keyStoreFormat='JKS', securityProvider='SunX509',
passphrase='null', bossGroup=null, workerGroup=null, networkInterface='null’}]

I could not find any examples of how to accomplish this.  Any hints?

Best regards,
Alex soto
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message