Hi,
As of today, we can add multiple interceptors to the invocation chain, but
we cannot control their ordering. When more policies are supported, I see a
need to provide some simple ordering mechnisim for interceptors.
SCA invocation may have three stages: reference, service and implementation.
For example, a typical invocation chain for the reference side can be:
reference: (SourceComponent) --> DataTransformation -->
Suspend/PropagateTransaction --> ReferenceBindingInvoker --> ...
service: (ServiceBindingListener) --> DataTransformation -->
PropagateTransaction
implementation: ManagedTransaction --> ImplementationInvoker -->
(TargetComponent)
Here is my proposal:
We introduce a phase concept which groups a collection of interceptors to a
relative position in the invocation chain for each stage. There are a list
of system defined phases (such as reference.invoker or
implementation.invoker) and it can be extended by Tuscany extensions.
Each phase is uniquely identied by the name. Each phase can define its
relative ordering using the 'before' and/or 'after' attributes. When an
interceptor is added to the InvocationChain, we can specify a phase name.
The Tuscany runtime will sort the phases by the partial order. SCA
invocations will be dispatched in the order of phases. There is no ordering
between interceptors in the same phase.
To define a phase, we use the following simple syntax in the service
provider file named as
"META-INF/services/org.apache.tuscany.sca.core.invocation.Phase".
name=PhaseName, stage=stageName, before=PhaseName4 PhaseName5,
after=PhaseName3
name: The name of the phase
stage: The stage of the phase, it can be one of the values: reference,
service, or implemention
before: A list of phase names separated by spaces to denote this phase
should be placed before
after: A list of phase names separated by spaces to denote this phase should
be placed after
A special phase name '*' can be used for 'before' and 'after' attribute to
represent all phases.
For example,
name=reference.invoker, stage=reference, after=*
name=reference.databinding, stage=reference, before=reference.invoker
name=reference.transaction, stage=reference, after=reference.databinding
I already have a prototype under development. Your opinions are welcome.
Thanks,
Raymond
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]