On Mon, Jun 28, 2010 at 5:57 AM, Jean-Sebastien Delfino
<[email protected]> wrote:
> I'm trying to implement a generic Java 'relay' component that relays
> requests from one binding to another. I may need to inspect and transform
> the request before relaying it.
>
> Is there a way for a component to implement a generic invocation interface,
> get the  invoked operation and input and relay it to a reference?
>
> Thanks
> --
> Jean-Sebastien
>

Hi Jean-Sebastien

The only place we've done this kind of thing to date is with the JMS
binding which dictates that a component must be able to implement an
onMessage(JMSMessage) style interface.

This is supported under the covers using Operation Selection (and
somewhat orthogonally Wire Format) handlers that can be specified as
part of the binding in the composite file. This is described on a
binding by binding basis. The Assembly spec describes wire format and
operation selection generally.

You can see some examples in the JMS itests [1]. However these tests
don't explicitly show the user configuration of an operation selector
being installed to enable the onMessage pattern. There is an operation
selector [2] but it's installed automatically to follow some, rather
complicated, default rules described in the JMS spec.

An option is to write your own operation selection handler and have it
always select a generic operation on a component if such a generic
interface is available. You are then in control and can pass anything
you like into that operation including the name of the target
operation and the message contents. A word of warning though. Not all
of our bindings support operation selection or wire formats just yet.
I believe that JMS, WS and HTTP do.

Simon

[1] http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/itest/jms/
[2] 
http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to