You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by MichaelAtSAG <me...@gmail.com> on 2013/08/16 22:35:53 UTC

Spring Bean represented as endpoint

All,
I am trying to move endpoint properties into a bean, yet the endpoint is not
working this way. I think it is a simple typo but can't find it:

====
THIS WORKS
====

<?xml version="1.0" encoding="UTF-8"?>
<beans 
	<camelContext>
	 		<endpoint id="websocketEndpoint"
uri="websocket://{{wsHost}}:{{wsPort}}/nerv-tweet?staticResources=classpath:.&amp;sendToAll=true"
/> 
	</camelContext>
</beans>

====
AND THIS DOES NOT WORK, YET FUNCTIONALLY THE SAME
====

<?xml version="1.0" encoding="UTF-8"?>
<beans 
	<bean id="appWebSocket"
class="org.apache.camel.component.websocket.WebsocketComponent">
		<property name="host" value="localhost" />
		<property name="port" value="9090" />
		<property name="staticResources" value="classpath:." />
	</bean>
	<camelContext>
	 	<endpoint id="websocketEndpoint"
uri="appWebSocket://nerv-tweet?sendToAll=true" /> 
	</camelContext>
</beans>

Any help to see the problem would be most welcome!
Thanks,
Michael



--
View this message in context: http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Spring Bean represented as endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
It could be an issue in the websocket component as its a bit more
special than a regular component.  And also configuring using endpoint
uri would usually assume host and port is being configured there, and
NOT from the component.



On Wed, Aug 21, 2013 at 4:13 AM, Willem jiang <wi...@gmail.com> wrote:
> I think you need to setup the CamelContext on the appWebSocket bean.
> BTW, what's the exception that you get when using the appWebSocket.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Saturday, August 17, 2013 at 4:35 AM, MichaelAtSAG wrote:
>
>> All,
>> I am trying to move endpoint properties into a bean, yet the endpoint is not
>> working this way. I think it is a simple typo but can't find it:
>>
>> ====
>> THIS WORKS
>> ====
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans
>> <camelContext>
>> <endpoint id="websocketEndpoint"
>> uri="websocket://{{wsHost}}:{{wsPort}}/nerv-tweet?staticResources=classpath:.&amp;sendToAll=true"
>> />
>> </camelContext>
>> </beans>
>>
>> ====
>> AND THIS DOES NOT WORK, YET FUNCTIONALLY THE SAME
>> ====
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans
>> <bean id="appWebSocket"
>> class="org.apache.camel.component.websocket.WebsocketComponent">
>> <property name="host" value="localhost" />
>> <property name="port" value="9090" />
>> <property name="staticResources" value="classpath:." />
>> </bean>
>> <camelContext>
>> <endpoint id="websocketEndpoint"
>> uri="appWebSocket://nerv-tweet?sendToAll=true" />
>> </camelContext>
>> </beans>
>>
>> Any help to see the problem would be most welcome!
>> Thanks,
>> Michael
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433.html
>> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
>
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Spring Bean represented as endpoint

Posted by Willem jiang <wi...@gmail.com>.
I think you need to setup the CamelContext on the appWebSocket bean.
BTW, what's the exception that you get when using the appWebSocket.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Saturday, August 17, 2013 at 4:35 AM, MichaelAtSAG wrote:

> All,
> I am trying to move endpoint properties into a bean, yet the endpoint is not
> working this way. I think it is a simple typo but can't find it:
>  
> ====
> THIS WORKS
> ====
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <beans  
> <camelContext>
> <endpoint id="websocketEndpoint"
> uri="websocket://{{wsHost}}:{{wsPort}}/nerv-tweet?staticResources=classpath:.&amp;sendToAll=true"
> />  
> </camelContext>
> </beans>
>  
> ====
> AND THIS DOES NOT WORK, YET FUNCTIONALLY THE SAME
> ====
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <beans  
> <bean id="appWebSocket"
> class="org.apache.camel.component.websocket.WebsocketComponent">
> <property name="host" value="localhost" />
> <property name="port" value="9090" />
> <property name="staticResources" value="classpath:." />
> </bean>
> <camelContext>
> <endpoint id="websocketEndpoint"
> uri="appWebSocket://nerv-tweet?sendToAll=true" />  
> </camelContext>
> </beans>
>  
> Any help to see the problem would be most welcome!
> Thanks,
> Michael
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Spring Bean represented as endpoint

Posted by MichaelAtSAG <me...@gmail.com>.
Apache Camel 2.11.0



--
View this message in context: http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433p5737614.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Spring Bean represented as endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
What version of Camel do you use?

On Fri, Aug 16, 2013 at 10:35 PM, MichaelAtSAG <me...@gmail.com> wrote:
> All,
> I am trying to move endpoint properties into a bean, yet the endpoint is not
> working this way. I think it is a simple typo but can't find it:
>
> ====
> THIS WORKS
> ====
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans
>         <camelContext>
>                         <endpoint id="websocketEndpoint"
> uri="websocket://{{wsHost}}:{{wsPort}}/nerv-tweet?staticResources=classpath:.&amp;sendToAll=true"
> />
>         </camelContext>
> </beans>
>
> ====
> AND THIS DOES NOT WORK, YET FUNCTIONALLY THE SAME
> ====
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans
>         <bean id="appWebSocket"
> class="org.apache.camel.component.websocket.WebsocketComponent">
>                 <property name="host" value="localhost" />
>                 <property name="port" value="9090" />
>                 <property name="staticResources" value="classpath:." />
>         </bean>
>         <camelContext>
>                 <endpoint id="websocketEndpoint"
> uri="appWebSocket://nerv-tweet?sendToAll=true" />
>         </camelContext>
> </beans>
>
> Any help to see the problem would be most welcome!
> Thanks,
> Michael
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen