You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jon Mithe <jo...@gmail.com> on 2014/07/17 21:51:21 UTC

Connecting to same server over different protocols

Hi,

I'm quite new to camel but I'm a little stuck with connecting to a server in
multiple ways.

I have a server, I talk to it via protobuff messages and have to login to it
to use it (cant use netty, all messages gets wrapped in a few "special"
bytes)  

I work on multiple apps / systems, sometime's I connect to it direct or via
a propriety broker (just writes additional header bytes/info for routing)

The problem I'm having is how to have it as a component/endpoint but
communicate to it in 2 ways especially as it requires logon.

So I thought to write a custom component with endpoint/producer/consumer,
this can do the login and hide it away from the apps.  Then define a route
like this for direct:

|   
from(direct:serverProtoQueue).marshall(protoToBytes).to(server?user=server;password=password);

That seems like it could be awesome, but how to fit the broker in there.  If
I have something like .to(broker) I then loose the server component and
managing the logon and then each app would have to process the logon.

With the broker I could write a second component but I'd have to share the
broker over many connections (all connections in the app could go over
broker), I suppose that could be injected, wait for the broker to connect
then do the logon itself.

I could maybe extract that out with the jndi registery and wrapping the
server components in a broker connection but its a little ugly:

|    from(direct:serverProtoQueue).marshall(protoToBytes).to(server);
|
|    //direct
|    register("server", new Server());
|
|    // broker
|    Broker broker = new Broker()
|    register("server", broker.connection(new Server(details),
routingdetails);
|    register("server2", broker.connection(new Server2(details2),
routingdetails2);
|    from(direct:brokerAdminQueue).to(broker);
 
I just cant see a way of doing this nicely, aside from the initial login of
the broker its really transparent.  I finding the double logon difficult. 
Also, to connect the servers the brokers connection must be up.

I kinda feel that if the route was honest it would end in to(broker)
however, I cant see a what of doing the server login without explicitly
calling that in the code / outside of camel. 

Unless maybe I can set some header information and the broker component can
have some injected mini-components to delegate to.  Not entirely sure then
to handle the start / stop as there is the broker connection and the
connection over the connection, mind breaks.

So I'm quite stuck with this now, any help to point me in the right
direction would be very much appreciated!

Thanks,
Jon



--
View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-same-server-over-different-protocols-tp5753985.html
Sent from the Camel - Users mailing list archive at Nabble.com.