Hi,

You need to add an extension to Tuscany and then you can add interceptors as follows:

1) Implement the org.apache.tuscany.sca.invocation.Interceptor interface for your interceptor

2) Implement org.apache.tuscany.sca.runtime.RuntimeWireProcessor interface

public void process(RuntimeWire wire) {
   List<InvocationChain> chains = wire.getInvocationChains();
   for (InvocationChain chain : chains) {
chain.addInterceptor(...); // Add your interceptor here per operation
   }
}

3) Implement org.apache.tuscany.sca.core.ModuleActivator interface and register your impl class with org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint in the module activator.

public class YourModuleActivator implements ModuleActivator {
   public void start(ExtensionPointRegistry registry) {
RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
       if (wireProcessorExtensionPoint != null) {
wireProcessorExtensionPoint.addWireProcessor(new YourRuntimeWireProcessor(mediator, dataBindings));
       }
   }

   public void stop(ExtensionPointRegistry registry) {
   }
}

4) Register your module activator in a file named "META-INF/services/org.apache.tuscany.sca.core.ModuleActivator". The content of the file will be the implementation class of your module activator.

The steps are a bit involved. We could simplify the RuntimeWireProcessor extensions by allowing registration using "META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessor". This will be a TODO for our future releases.

Thanks,
Raymond

----- Original Message ----- From: "haleh mahbod" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, October 22, 2007 9:53 PM
Subject: Re: Interceptors between services


Hi Deepak,
There is support for policy in SCA release 1.0. Is this what you are
referring to here?

Haleh

On 8/3/07, Deepak Nadig <[EMAIL PROTECTED]> wrote:


Hi,

Are there any plans for an interceptor model between service invocations?
While the framework does a good job in wiring services into a composite, I
did not find a good way for applications to intercept calls into/out-of
services.

Thanks,

Deepak






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to