[ https://issues.apache.org/jira/browse/OFBIZ-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacopo Cappellato reassigned OFBIZ-5793: ---------------------------------------- Assignee: Jacopo Cappellato > modify logic to only run expiry service once when subscription expires > ---------------------------------------------------------------------- > > Key: OFBIZ-5793 > URL: https://issues.apache.org/jira/browse/OFBIZ-5793 > Project: OFBiz > Issue Type: Improvement > Components: product > Affects Versions: Trunk > Environment: not relevant > Reporter: Ivan Cauchi > Assignee: Jacopo Cappellato > Priority: Minor > Labels: subscription > Fix For: Trunk > > Attachments: OFBIZ-5793.patch > > Original Estimate: 672h > Remaining Estimate: 672h > > Background > --------------- > Recenlty, the trunk version of OFBiz was augmented with a new service called runServiceUponSubscriptionExpiry through JIRA5333. This service is scheduled to run, using the demo data, once a day. Its algorithm looks up all subscriptions which have expired, which is defined as the current time being greater than the sum of the subscription.thruDate + subscription.gracePeriodOnExpiry, and Subscription.automaticExtend is false. For all such subscriptions, the service runs any service named in SubscriptionResource.serviceNameOnExpiry. > This provides users of the OFBiz framework who provide subscriptions to their customers using the framework, to trigger an external deprovisioning action when a subscription expires, implemented as a service whose name is inserted into SubscriptionResource.serviceNameOnExpiry. > Currently, the service mentioned in SubscriptionResource.serviceNameOnExpiry is run every time the master service runServiceUponSubscriptionExpiry goes through its algorithm (once a day in the demo data). Typically, for subscriptions which require a deprovisioning action when the subscription expired, one and only one deprovisioning action would be required. > proposed solution > ----------------------- > To resolve this, it is being proposed to make the following adjustments: > a) augment the OFBiz data model with the following new field: > Subscription.expirationCompletedDate > b) modify the algorithm of runServiceUponSubscriptionExpiry to also check whether the expiry service has already run, by checking that expirationCompletedDate is null. > - if expirationCompletedDate is null (and the other conditions are satisfied), run the service in SubscriptionResource.serviceNameOnExpiry and update the date/time into expirationCompletedDate > - if expirationCompletedDate is not null, skip the expired subscription and move to the next > Testing > --------- > 1. create a new subscription through OFBiz with demo data > 2. modify the subscription's thru date and gracePeriodOnExpiry so the result of their addition is in the past of the system date > 3. verify that Subscription.expirationCompletedDate is empty > 4. either wait for the daily running of runServiceUponSubscriptionExpiry, or trigger the service manually > 5. verify that the log file contains a reference to the subscription having expired, and that Subscription. expirationCompletedDate contains the date/time the service was run > 6. either wait for the daily running of runServiceUponSubscriptionExpiry, or trigger the service manually, for a second time > 7. verify that the log file does not contain a reference to the subscription having expired, and that Subscription.expirationCompletedDate still contains the date/time the service was run -- This message was sent by Atlassian JIRA (v6.3.4#6332) |
Free forum by Nabble | Edit this page |