camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ranx <brad.john...@mediadriver.com>
Subject Re: Netty Server vs Jetty Server
Date Fri, 02 Sep 2016 17:13:35 GMT
I think maybe a better explanation of what I'd like to accomplish is in
order.  The first is about CXF itself and the second is about Netty. The
following is an example of a service I've set up that uses a single
interface called PaymentServicesAPI which is nothing more than an interface
that extends other interfaces like PaymentAuthorization, PaymentSale,
PaymentRefud, etc.  So I only have to set this up once and then it routes to
whatever bundle is listening on the route that matches the operationName. 
This works fine but has the obvious problem that if I want to move the
bundle that implements the service associated with one of the operations the
aggregate interface still exposes that interface.  

To build bundles as portable microservices this is a problem.

Each of the interfaces is decorated with SOAP and Rest annotations.  What
I'd like to do is be able to set up the CXF Rest and SOAP servers with
providers, security, etc. in a single bundle.  Then in my individual bundles
make a reference to it in the same way that I see in the netty example.

<from
uri=&quot;netty4-http:http://0.0.0.0:{{port}}/foo?bootstrapConfiguration=#nettyHttpBootstrapOptions&quot;

The CXF example. I don't want to add the cxf:rsServer and Soap server to
every bundle just to expose the common interface.

It seems likely there's a way to share this information in much the same was
the boot strap options are in Netty.  But I haven't seen an example of it.
In the example below the PaymentServicesAPI is the on that extends all the
others. What I'd like to do is set up the cxf:rsServer in single bundle and
set the service class in the consuming bundles. More like this:

&lt;from uri=&quot;cxfrs:bean:gatewayRESTEndpoint=#gatewayRestServer&quot;
/> In that case the cxf:rsServer wouldn't actually bind the service class
until the individual bundle requested it.  I was able to roll my own version
by hand coding an OSGi service interface that gets exported from the server
bundle and lets individual bundles send registration notices at which point
it adds (or removes) the endpoint.  But I'm wondering if there's just
something I'm missing.

	<cxf:rsServer id="gatewayRESTServer" address="${CXFServer}/resources"
serviceClass="org.foo.PaymentServiceAPI">

		<cxf:providers>
			<bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
				<property name="convention" value="badgerfish" />
			</bean>
			<bean class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
				<property name="linkJsonToXmlSchema" value="true" />
				<property name="applicationTitle" value="PaymentHubRestServices" />
			</bean>
		</cxf:providers>
	
	</cxf:rsServer>

	<camelContext id="My-Rest-context"
xmlns="http://camel.apache.org/schema/blueprint">

		<route id="Gateway-RS">
			<from uri="cxfrs:bean:gatewayRESTEndpoint" />
			<log message="Received header.operationName: ${header.operationName}" />
			<transform>
				<simple>${body[0]}</simple>
			</transform>

			<recipientList>
				<simple>direct-vm:${header.operationName}</simple>
			</recipientList>

		</route>
	</camelContext>



--
View this message in context: http://camel.465427.n5.nabble.com/Netty-Server-vs-Jetty-Server-tp5787145p5787152.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message