Sylvester,
Every xbean.xml file should be targeted at a single component. In your
case, you'll need to make two service units, one targeted at the
servicemix-jsr181 component for the two JSR181 endpoints and another
target at the servicemix-camel component for your camel-context. You
can package both in a single SA if you want, but you do need to have a
separate SU for every component in ServiceMix 3. If you look at
http://servicemix.apache.org/3-beginner-using-apache-camel-inside-servicemix.html,
you'll notice the same pattern: one SU for the Camel routes and an
additional JMS SU for the JMS endpoints.
Regards,
Gert
Sylvester wrote:
Hi,
I have managed to deploy a simple camel component in service mix. I am
now having problems with the routing slip pattern.
Structure:
A JMS BC receives the JMS message. This is then forwarded to the camel
endpoint which routs it to various JSR181 endpoints specified in the
routing slip header. Now, I have no problem hitting the first
endpoint. The problem starts when the output of the first endpoint is
not compatible with the input needed by the second endpoint.
So *Question#1* - How do I control the output of the first endpoint?
Also, in my search to solve question#1- I did this to my fist JSR181
endpoint:
WebService(serviceName = "ExampleJSRService123", targetNamespace =
"http://example.com/exampleServiceJSR123")
public class ExampleService {
@WebMethod
public void sayHello(DefaultMessage defaultMessage) {
System.out.println("ExampleJSRService123 says hello! "+
defaultMessage);
System.out.println(defaultMessage.getBody());
// return "<sayHello><name>hai</name></sayHello>";
}
Maven builds this just fine, but servicemix says the following when I
deploy it:
<component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message"
>
<component-name>servicemix-jsr181</component-name>
<component-task-result-details>
<task-result-details>
<task-id>deploy</task-id>
<task-result>FAILED</task-result>
<message-type>ERROR</message-type>
<task-status-msg>
<msg-loc-info>
<loc-token/>
<loc-message>Unable to find suitable deployer for Service Unit
'CamelJSRSU'</loc
-message>
</msg-loc-info>
</task-status-msg>
</task-result-details>
</component-task-result-details>
</component-task-result>
</jbi-task-result>
</jbi-task>
I read on previous posts that the camel component needs a
camel-context and not an xbean so I tried the following combinations
in the SU:
1. Only xbean
2. Xbean and camel context
3. only camel context initializing the endpoints like:
!-- START SNIPPET: camel -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
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-2.0.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
">
<!--
from("seda:a").to("seda:b");
-->
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<package>org.CamelJSRSU</package>
</camelContext>
<jsr181:endpoint pojoClass="org.CamelJSRSU.ExampleService" />
<jsr181:endpoint pojoClass="org.CamelJSRSU.ExampleService2" />
</beans>
My hunch is that a camel-context is not needed here, but thought I
should try it out before I post it here.
*Question#2: *How do I correctly deploy this component (xbean?
camel-context? anything else?)
Thanks.
Sylvester