Luciano Resende pisze:
On Tue, Mar 31, 2009 at 10:09 AM, Wojtek Janiszewski
<[email protected]> wrote:
Having this extension implemented as binding extension gives us possibility
to expose SCA components as Erlang modules or message boxes. I assumed that
it wouldn't be possible with implementation extension.


How would be the usage scenario here ? How do you define the component
that access Erlang and how do you define the Erlang component that
exposes the service ? do you mind providing a composite snippet here ?


Some JUnit tests already uses composites and full version can be found in SVN repositroy under [1], [2].

Sample for accessing Erlang module by a reference:

        <component name="ReferenceTest">
        <implementation.java class="..." />
        ...
        <reference name="moduleReference">
                <tuscany:binding.erlang node="RPCServer" module="hello"/>
        </reference>
        ...
        </component>

Where target Erlang node name will be "hello" and function name will be taken from operation name which is invoked on reference.


Here is example for exposing SCA component as Erlang module:
        <component name="ServiceTest">
                <implementation.java class="..." />
        </component>
        <service name="ServiceTest" promote="ServiceTest">
                <interface.java interface="..." />
                <tuscany:binding.erlang node="RPCServer" module="hello"/>
        </service>

Where Erlang module name will be called "hello" and function names would be based on service interface operation names.

Binding declaration for messaging is very similar, but in runtime operation name is used to determine message box. So in Erlang service if there comes message addressed to "hello" mbox then operation hello on SCA component will be executed. If such method has non void return type appropriate reply would be sent to sender.

For messaging in Erlang references invoking operation "hello" will cause sending message to mbox named "hello" and again, optionally waiting for reply.

Thanks,
Wojtek

[1] - sandbox/wjaniszewski/binding-erlang-runtime/src/test/resources/ErlangService.composite [2] - sandbox/wjaniszewski/binding-erlang-runtime/src/test/resources/ErlangReference.composite

Reply via email to