Understanding Interceptor Key Concepts
It is imperative that we understand the key concepts of interceptors before we proceed with writing one. Interceptors in Fuji are, in theory, based on the Aspect Oriented Programming(AOP) technique. They allow you to apply advice at a set of point cuts. The following key elements define interceptors in Fuji :
Intercepted Entity : What is Intercepted?
Interceptors are injected onto the message path and can intercept the Messages being exchanged on that path or the entire Message Exchange. So, interceptors can intercept the :
- Entire Message Exchange
- Message
- Message payload
Each of the above is the advised object in terms of AOP. Let's go over each of these in detail.
Intercepting the Message Exchange
This gives the interceptor the most flexibility in altering the course of the message flow and it's content. An interceptor which intercepts a message exchange can
- read the message(s) in the exchange
- read the message(s) properties
- update the message
- update the message properties
- update the message exchange status
- short the exchange
The updates need to be made within the limits of the Message Exchange Pattern.
The message exchange interceptor can short the message exchange, for example a interceptor intercepting the message exchange on the "in" message path, can set the "out" message on the exchange and short it ( we will see in the examples section how a exchange is "shorted"). When the message exchange is shorted this way, the message exchange is marked as "DONE" and sent back to the sender.
Intercepting the Message
Either the "in" or "out" message in the exchange can be intercepted. An interceptor that intercepts a message can
- read the current message
- read the current message properties
- update the current message
- update the current message properties
Intercepting the Message Payload
Either the "in" or "out" message in the exchange can be intercepted. An interceptor that intercepts a message can
- read the current message
- update the current message
"current message" refers to the message being exchanged on the message path when the interceptor is invoked.
Interception Point : Where is it intercepted?
The Message (Exchange) is intercepted when it is being sent on the delivery channel i.e. when the consumer/provider creates/updates the exchange and puts it onto the delivery channel. The senders thread of execution is used to invoke the interceptors. If an interceptor fails ( throws an exception ), the message exchange is terminated and sent back to the sender.
Interception point is equivalent to a join point in AOP.
Interception Scope : When is it intercepted?
The Interception Scope defines when an interceptor is fired. For instance if an interceptor is written to augment the functionality of the HTTP Binding Component and is to be fired whenever a HTTP Request is received, one can specify the interceptor scope to be just that i.e. fire the interceptor when the consumer is the HTTP BC. One can think of the interception scope to be a set of conditions which narrow down the firing of the interceptor. This scope is user defined.
Comparing this to AOP, interception scope is equivalent to point cuts.
Interceptor : Logic that is applied
The interceptor is the logic that is applied at the point of interception. In terms of AOP this is the advice that is applied to the message exchange at the interception point. The interceptor is a simple user defined POJO that is injected into the message path ( see
Interceptor Injection 
. More then one interceptor can be in scope at the interception point, each of these is fired based on their priority. Priority is a user defined property of interceptors and can be specified in the
Intercept Annotation
This page (revision-11) was last changed on
30-Jul-09 14:35 PM, -0700
by MarkWhite.
This page was created on
15-Sep-08 12:47 PM, -0700 by JBIWIKI.
Back to Fuji Interceptors Key Concepts
| Version |
Date |
Author |
Size |
Changes ... |
|
11
|
30-Jul-09 14:35 PM, -0700
|
MarkWhite |
4067 |
to previous
|
|
10
|
30-Jul-09 14:35 PM, -0700
|
MarkWhite |
4069 |
to previous
|
to last
|
|
9
|
17-Oct-08 13:58 PM, -0700
|
JBIWIKI |
4059 |
to previous
|
to last
|
|
8
|
17-Oct-08 13:54 PM, -0700
|
JBIWIKI |
3937 |
to previous
|
to last
|
|
7
|
16-Sep-08 14:21 PM, -0700
|
JBIWIKI |
3969 |
to previous
|
to last
|
|
6
|
15-Sep-08 22:34 PM, -0700
|
JBIWIKI |
3970 |
to previous
|
to last
|
|
5
|
15-Sep-08 22:24 PM, -0700
|
JBIWIKI |
3612 |
to previous
|
to last
|
|
4
|
15-Sep-08 15:05 PM, -0700
|
JBIWIKI |
2331 |
to previous
|
to last
|
|
3
|
15-Sep-08 14:51 PM, -0700
|
JBIWIKI |
2323 |
to previous
|
to last
|
|
2
|
15-Sep-08 14:41 PM, -0700
|
JBIWIKI |
1313 |
to previous
|
to last
|
|
1
|
15-Sep-08 12:47 PM, -0700
|
JBIWIKI |
754 |
to last
|