[
https://issues.apache.org/jira/browse/STRATOS-777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nirmal Fernando resolved STRATOS-777.
-------------------------------------
Resolution: Fixed
> Introduce subscription filters to intercept a new subscription
> --------------------------------------------------------------
>
> Key: STRATOS-777
> URL: https://issues.apache.org/jira/browse/STRATOS-777
> Project: Stratos
> Issue Type: New Feature
> Components: Stratos Manager
> Affects Versions: 4.0.0
> Reporter: Nirmal Fernando
> Assignee: Nirmal Fernando
> Fix For: 4.1.0
>
>
> Currently, there's no clean way to intercept a subscription request and do
> some pre-processing. As of now, we do some pre-processing of a subscription
> request in order to identify the need of a load balancer and act accordingly.
> I currently have another use-case to intercept a subscription request and act
> upon a parameter.
> Hence, to make the code clean over there, I propose we introduce a
> Subscription Filter chain where you could intercept a subscription request
> and do some pre-processing before creating the actual subscription.
> Following is the interface design, I've come up with.
> /**
> * Intercepts the flow of Cartridge Subscription.
> * Implementations of this class would get executed before making the real
> subscription.
> */
> public interface SubscriptionFilter {
> /**
> * Do some pre-processing on a subscription request.
> * @param cartridgeInfo {@link CartridgeInfo}
> * @param subscriptionData {@link SubscriptionData}
> * @return {@link Properties}, if there are any.
> * @throws ADCException on a failure while processing.
> */
> public Properties execute(CartridgeInfo cartridgeInfo, SubscriptionData
> subscriptionData) throws ADCException ;
> }
> Filters could leverage these key-value pairs to pass properties into the main
> subscription.
> One existing use-case is passing LB subscription related properties to the
> main subscription.
> You would need to implement the interface and add the fully qualified class
> name of it, to the META-INF/services folder in a file named
> "org.apache.stratos.manager.subscription.filter.SubscriptionFilter" (I am
> planning to use the Java ServiceLoader -
> http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)