Uploaded image for project: 'Stratos'
  1. Stratos
  2. STRATOS-777

Introduce subscription filters to intercept a new subscription

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0
    • Fix Version/s: 4.1.0 RC3
    • Component/s: Stratos Manager
    • Labels:
      None

      Description

      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)

        Activity

        Hide
        nirmal Nirmal Fernando added a comment -

        Committed in d606deef446bb56db9dd10663e4541a1437911f9 and 491fdb7e2873b9b8df587a1092792762352116d5

        Show
        nirmal Nirmal Fernando added a comment - Committed in d606deef446bb56db9dd10663e4541a1437911f9 and 491fdb7e2873b9b8df587a1092792762352116d5

          People

          • Assignee:
            nirmal Nirmal Fernando
            Reporter:
            nirmal Nirmal Fernando
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development