You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sushmita chandra <fl...@gmail.com> on 2011/07/14 13:12:33 UTC

For writing a custom codec for Mina EndPoint where should I place the code for registering with JNDI registry?

I have written a custom codec,added the reference in the spring XML and have
written the code for registering with JNDI inside the routebuilder class's
configure method as below:

void configure(){

-------------
------------
JndiRegistry jndi=new JndiRegistry()
jndi.bind("XMLCodec",new XMLCodec())
context = new DefaultCamelContext(jndi.getContext())
		
from('mina:tcp://0.0.0.0:9091?sync=true&codec=#XMLCodec')
----------------
----------------
.to(some endpoint)
}


But when I run this I can see in the console "Total 0 routes, of which 0 is
started.":



Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext start
INFO: Apache Camel 2.5.0 (CamelContext: camelContext) is starting
Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext
createManagementStrategy
INFO: JMX enabled. Using ManagedManagementStrategy.
Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext start
INFO: Total 0 routes, of which 0 is started.
Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext start
INFO: Apache Camel 2.5.0 (CamelContext: camelContext) started in 0.266
seconds


I am not sure as to which is the correct place in the code to place the code
to register with JNDI.
Can anyone please help me figure out why the routes are not starting?

--
View this message in context: http://camel.465427.n5.nabble.com/For-writing-a-custom-codec-for-Mina-EndPoint-where-should-I-place-the-code-for-registering-with-JNDI-tp4586277p4586277.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: For writing a custom codec for Mina EndPoint where should I place the code for registering with JNDI registry?

Posted by Claus Ibsen <cl...@gmail.com>.
I assume the configure() method is from a class that extends RouteBuilder



On Thu, Jul 14, 2011 at 2:35 PM, Sushmita chandra
<fl...@gmail.com> wrote:
> void configure()throws NumberFormatException {
>
>
>
>                JndiRegistry jndi=new JndiRegistry()
>                jndi.bind("XMLCodec",new XMLCodec())
>                context = new DefaultCamelContext(jndi.getContext())
>

This code should be done *before* you invoke the configure method.
It should be done where you create the CamelContext.



>                from('mina:tcp://0.0.0.0:9091?sync=true&codec=#XMLCodec')
>                .process(new MinaProcessor())
>                .to('direct:inputcsgAdapter');
> }
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/For-writing-a-custom-codec-for-Mina-EndPoint-where-should-I-place-the-code-for-registering-with-JNDI-tp4586277p4586493.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: For writing a custom codec for Mina EndPoint where should I place the code for registering with JNDI registry?

Posted by Sushmita chandra <fl...@gmail.com>.
void configure()throws NumberFormatException {	
		
		
		
		JndiRegistry jndi=new JndiRegistry()
		jndi.bind("XMLCodec",new XMLCodec())
		context = new DefaultCamelContext(jndi.getContext())
		
		from('mina:tcp://0.0.0.0:9091?sync=true&codec=#XMLCodec')
		.process(new MinaProcessor())
		.to('direct:inputcsgAdapter');
}

--
View this message in context: http://camel.465427.n5.nabble.com/For-writing-a-custom-codec-for-Mina-EndPoint-where-should-I-place-the-code-for-registering-with-JNDI-tp4586277p4586493.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: For writing a custom codec for Mina EndPoint where should I place the code for registering with JNDI registry?

Posted by Claus Ibsen <cl...@gmail.com>.
Are you sure you add the routes?

Can you post the full code?



On Thu, Jul 14, 2011 at 1:12 PM, Sushmita chandra
<fl...@gmail.com> wrote:
> I have written a custom codec,added the reference in the spring XML and have
> written the code for registering with JNDI inside the routebuilder class's
> configure method as below:
>
> void configure(){
>
> -------------
> ------------
> JndiRegistry jndi=new JndiRegistry()
> jndi.bind("XMLCodec",new XMLCodec())
> context = new DefaultCamelContext(jndi.getContext())
>
> from('mina:tcp://0.0.0.0:9091?sync=true&codec=#XMLCodec')
> ----------------
> ----------------
> .to(some endpoint)
> }
>
>
> But when I run this I can see in the console "Total 0 routes, of which 0 is
> started.":
>
>
>
> Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext start
> INFO: Apache Camel 2.5.0 (CamelContext: camelContext) is starting
> Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext
> createManagementStrategy
> INFO: JMX enabled. Using ManagedManagementStrategy.
> Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext start
> INFO: Total 0 routes, of which 0 is started.
> Jul 14, 2011 4:26:02 PM org.apache.camel.impl.DefaultCamelContext start
> INFO: Apache Camel 2.5.0 (CamelContext: camelContext) started in 0.266
> seconds
>
>
> I am not sure as to which is the correct place in the code to place the code
> to register with JNDI.
> Can anyone please help me figure out why the routes are not starting?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/For-writing-a-custom-codec-for-Mina-EndPoint-where-should-I-place-the-code-for-registering-with-JNDI-tp4586277p4586277.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/