You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Ivan Cauchi (JIRA)" <ji...@apache.org> on 2014/10/20 04:17:33 UTC

[jira] [Commented] (OFBIZ-5793) modify logic to only run expiry service once when subscription expires

    [ https://issues.apache.org/jira/browse/OFBIZ-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14176538#comment-14176538 ] 

Ivan Cauchi commented on OFBIZ-5793:
------------------------------------

Patch has been uploaded.  

We have bundled in a removal, for hygiene reasons, of the field Subscription.serviceNameOnExpiry, which we had previously added in JIRA5333, which wasn't being used by service runServiceOnSubscriptionExpiry (which already uses SubscriptionResource.serviceNameOnExpiry instead).

We invite any committer to test and release into trunk if accepted.

When released we'll be documenting this together with the new function introduced by JIRA5333 into Confluence.

> 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
>            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)