Hey Dan,

Thanks for putting these notes together.  Very useful and I will definitely slap this into an article in the SwitchYard community.  One small change to the steps you've used:


# add <component name="Hello"></component> and <component name="Goodbye"></component> nodes as children of the <composite> node in switchyard.xml

This is not necessary and I'll tell you why in one sec ...


switchyard add-reference --referenceName Hello --interfaceType java --interface org.example.greeting.Hello --componentName Hello
switchyard add-reference --referenceName Goodbye --interfaceType java --interface org.example.greeting.Goodbye --componentName Goodbye

I left out an important detail in my prior email, which is that the target component for these references should be the Greeting service component.  A service reference is essentially documentation of a dependency on another service (e.g. @Inject in a bean, import … in a Java class, etc.).  So in this case, you want to add the references to the component which is calling the service(s).  Modifying your instructions, it should look like this:

switchyard add-reference --referenceName Hello --interfaceType java --interface org.example.greeting.Hello --componentName Greeting
switchyard add-reference --referenceName Goodbye --interfaceType java --interface org.example.greeting.Goodbye --componentName Greeting

The reason why it works with your original commands is that there's a bug (which you uncovered ;-) ) where service references are shared across all service components in an application.  So even though you were defining the service reference on the Hello service component, the Greeting service component was able to resolve the same reference at runtime.  This also required you to add the extra component definitions to switchyard.xml in order to add the reference to them.

Bottom line is that if you use the modified commands above, it will still work and you won't have to muck with the XML at all.  Here's the JIRA for the bug:
https://issues.jboss.org/browse/SWITCHYARD-915

cheers,
keith



test

switchyard promote-service --serviceName Greeting
camel-binding bind-service --serviceName Greeting --configURI file:///tmp/input

build

# deploy target/greeting.jar to SwitchYard AS 7 Server (http://downloads.jboss.org/switchyard/releases/v0.5.Beta1/switchyard-as7-0.5.0.Beta1.zip)

mkdir /tmp/input
echo "SwitchYard" > /tmp/input/message.txt

# Observe the following output in the AS 7 console:
# INFO  [stdout] (Camel (camel-5) thread #10 - file:///tmp/input) Hello, SwitchYard
# INFO  [stdout] (Camel (camel-5) thread #10 - file:///tmp/input
# INFO  [stdout] (Camel (camel-5) thread #10 - file:///tmp/input) Goodbye, SwitchYard
# INFO  [stdout] (Camel (camel-5) thread #10 - file:///tmp/input

Good luck!

-Dan

On Fri, Jul 6, 2012 at 6:34 PM, Dan Allen <dan.j.allen@gmail.com> wrote:
On Fri, Jul 6, 2012 at 5:53 PM, Keith Babo <kbabo@redhat.com> wrote:
This is a "feature" of the XML validation in Eclipse.  Disable "Honour all scheme locations" under XML - Validation (or something like that).

When I got back a test with lots of red marks, I should have asked my teacher "is it possible to turn off this validation feature?"

hahaha

-Dan

--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597





--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597