Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-5333

Trigger for service to run upon subscription expiry




      This issue is a follow up of a discussion on the Ofbiz user and dev fora, titled 'Subscription Functionality'.

      The main characteristics of the Ofbiz subscriptions are:
      a) the access control of the subscribed internal content is missing, and can be provided by custom means. As well, subscription to content on external systems needs a trigger, which can be provided through Content.serviceName.
      b) the subscription model has an inbuilt assumption that access to the resource is terminated outside of the default Ofbiz, such as by a custom Ofbiz process or an external process.

      The generic use case I'm thinking of is external systems providing content to which a client desires to subscribe which don't have an inbuilt expiry. These systems require a trigger to enable provisioning, and another trigger to enable deprovisioning.

      Ofbiz can be used to manage the provision of access to such external content, triggering the provisioning process through a service in Content.serviceName. What's missing is an (optional) trigger for the deprovisioning process.

      One way which we're thinking of resolving this is:
      a) to add another column to the SubscriptionResource entity, called serviceNameOnExpiry (note to people that had followed the discussion on the Ofbiz mailing lists: the field name has been shortened to fit the 30 character limit). This would contain the service to run to trigger the deprovisioning process. If containing null, nothing would be run, and Ofbiz exhibits the current default behaviour.
      b) create a new service runServiceOnSubscriptionExpiry within SubscriptionServices.java, that is scheduled to run regularly, similar to the existing runSubscriptionAutoReorder. This code would check whether a subscription has expired. If so, and a service exists within SubscriptionResource.serviceNameOnExpiry, and Subscription.automaticExtend=N, this code runs that service.

      This approach has the advantage of complete separation of the default and new functionality with the cost of some additional database lookups.

      We will be submitting patches for this new functionality shortly.




            jleroux Jacques Le Roux
            mynah Ivan Cauchi
            0 Vote for this issue
            5 Start watching this issue