Sure. The Inteceptor is called on the "setNext()" method to receive the next
interceptor in the chain. But the interceptor has freedom to decide if it
should delegates to the next one.
For example, in the invoke(Message msg) implementation:
// do something
return getNext().invoke(msg);
or
// do something
return myMsg;
Thanks,
Raymond
From: Douglas Leite
Sent: Monday, October 19, 2009 11:15 AM
To: Tuscany-Developers
Subject: Doubt - Policies and Invocation Chain
Hi,
I would like to know if is possible to invoke a specific method from a
component inside an interceptor. For example, let's suppose the following
scenario: A component CalcComponent that has the operations add and sub, and a
reference to a AddComponent and a SubComponent. The add method uses the
reference to the AddComponent to invoke the addMethod (that is part of the
service interface of the AddComponent). The sub method works similarly to the
add. Suppose that I am using some policy (like logging) in the add and sub
methods.
The simplified invocation chain would work like that:
1) add -> Interceptor for the add -> Interceptor for the addMethod -> addMethod
2) sub -> Interceptor for the sub -> Interceptor for the subMethod -> subMethod
So, is possible, for example, in some interceptor at the fist invocation chain,
invoke the subMethod instead of the addMethod, or return to the add method a
combination of results of the addMethod and subMethod?
Thanks,
--
Douglas Siqueira Leite
Graduate student at University of Campinas (Unicamp), Brazil