Hi
If you use spring to expose a bean then its even easier. Just invoke
it as a bean in the Camel route
from(timer)
.to("bean:helloServiceBean?method=hello")
// and continue routing if you need to
On Mon, Apr 11, 2011 at 6:20 PM, Filippo Balicchia <[email protected]> wrote:
> Hello thanks for help,
> but I don't understand how i Can call my RMI Server. from a route
> configuration.
> My RMI Server is expose with spring remoting.
>
> What i'd like to do is
> from(timer)
> .to(Spring remoting client)
> .to(bean)
>
> What I don't understand is how i can define my spring remote client in th
> route
>
> When i lunch my client as a stanalone clone i use the following code
>
> ApplicationContext ctx = new ClassPathXmlApplicationContext(
> "rmi-client-context.xml");
> HelloService deliveryService = (HelloService) ctx
> .getBean("helloServiceBean");
> System.out.println(deliveryService.hello("Hello"));
> System.out.println(deliveryService.hello());
>
> and spring conf is
>
> <bean id="helloServiceBean"
> class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
> <property name="serviceUrl"
> value="rmi://localhost:1234/helloServiceBean"/>
> <property name="serviceInterface"
> value="com.mylab.mock.commons.HelloService"/>
> </bean>
>
> Could you please tell me how i can reproduce the same Behaviour ?
>
> Thanks for help
>
> --Filippo
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 2011/4/11 Claus Ibsen <[email protected]>
>
>> Hi
>>
>> See the rmi example in the Apache Camel 2.7 release.
>>
>> https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-osgi-rmi/
>>
>>
>> On Sun, Apr 10, 2011 at 4:02 PM, Filippo Balicchia <[email protected]>
>> wrote:
>> > Hello,
>> > thanks for response but I don't understand how i can call my remote
>> method.
>> >
>> > Explanation:
>> >
>> > 1: Camel rounting information looks like this
>> > from("timer://myTimer?period=30000").to("bean:helloServiceBean").bean(new
>> > SomeBean());
>> > 2: helloServiceBean is defined in a file xml called camel-context.xml
>> that
>> > look like this
>> >
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xsi:schemaLocation="
>> > http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> > http://camel.apache.org/schema/spring
>> > http://camel.apache.org/schema/spring/camel-spring.xsd">
>> >
>> > <camelContext id="camelRmiTest"
>> > xmlns="http://camel.apache.org/schema/spring">
>> > <package>org.apache.camel.example.spring</package>
>> > <jmxAgent id="agent" createConnector="true"/>
>> > </camelContext>
>> >
>> > <bean id="helloServiceBean"
>> > class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
>> > <property name="serviceUrl"
>> > value="rmi://localhost:1234/helloServiceBean"/>
>> > <property name="serviceInterface"
>> > value="com.mylab.mock.commons.HelloService"/>
>> > </bean>
>> > </beans>
>> >
>> > 3: On the server side i have
>> > <beans>
>> > <bean id="helloServiceBean"
>> > class="com.mylab.mock.server.HelloServiceImpl">
>> > </bean>
>> >
>> > <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
>> > <property name="serviceName" value="helloServiceBean"/>
>> > <property name="service" ref="helloServiceBean"/>
>> > <property name="serviceInterface"
>> > value="com.mylab.mock.commons.HelloService"/>
>> > <property name="registryPort" value="1234"/>
>> > </bean>
>> > </beans>
>> >
>> >
>> > It seam is ok but when i run the package i receive the following error
>> >
>> > Failed delivery for exchangeId: ID-fbalicchia-4354-1302443726203-0-2.
>> > Exhausted
>> > after delivery attempt: 1 caught:
>> org.apache.camel.RuntimeCamelException:
>> > java.
>> > rmi.UnmarshalException: error unmarshalling return; nested exception is:
>> > java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiIn
>> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
>> > org.apache.camel.RuntimeCamelException: java.rmi.UnmarshalException:
>> error
>> > unmar
>> > shalling return; nested exception is:
>> > java.lang.ClassNotFoundException:
>> > org.springframework.remoting.rmi.RmiIn
>> > vocationWrapper_Stub (no security manager: RMI class loader disabled)
>> >
>> > How can I enable secuirty manager ?
>> > than here i can call my remote method and how.
>> > In new someBean at the end of rounting information is ok ?
>> >
>> > Thanks
>> >
>> > --Filippo
>> >
>> >
>> >
>> >
>> > 2011/4/10 Claus Ibsen <[email protected]>
>> >
>> >> You can use the timer or quartz endpoint to trigger the scheduling.
>> >> And then invoke the rmi service, and then after that the bean.
>> >>
>> >> Something like:
>> >>
>> >> from(timer)
>> >> .to(rmi)
>> >> .to(bean)
>> >>
>> >>
>> >> On Sun, Apr 10, 2011 at 8:55 AM, Filippo Balicchia <
>> [email protected]>
>> >> wrote:
>> >> > Hello,
>> >> > I need to implement an example that Scheduled consumes messages from a
>> >> > remote RMI Server and invoke a bean with the received message.
>> >> >
>> >> > The server RMI in a simple hello world server that is exposed with
>> spring
>> >> > Remoting.
>> >> >
>> >> > Could you suggest me, please, where some examples if are there or
>> address
>> >> > me, my camel route consume a message from rmi not exposed like the
>> >> example
>> >> > found in Camel package
>> >> >
>> >> > Thanks for help.
>> >> >
>> >> > --Filippo
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> FuseSource
>> >> Email: [email protected]
>> >> Web: http://fusesource.com
>> >> CamelOne 2011: http://fusesource.com/camelone2011/
>> >> Twitter: davsclaus
>> >> Blog: http://davsclaus.blogspot.com/
>> >> Author of Camel in Action: http://www.manning.com/ibsen/
>> >>
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [email protected]
>> Web: http://fusesource.com
>> CamelOne 2011: http://fusesource.com/camelone2011/
>> Twitter: davsclaus
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/