Class ExpandBillingRecurrencesPipeline

java.lang.Object
google.registry.beam.billing.ExpandBillingRecurrencesPipeline
All Implemented Interfaces:
Serializable

public class ExpandBillingRecurrencesPipeline extends Object implements Serializable
Definition of a Dataflow Flex pipeline template, which expands BillingRecurrence to BillingEvent when an autorenew occurs within the given time frame.

This pipeline works in three stages:

  • Gather the BillingRecurrences that are in scope for expansion. The exact condition of BillingRecurrences to include can be found in getRecurrencesInScope(Pipeline).
  • Expand the BillingRecurrences to BillingEvent (and corresponding DomainHistory) that fall within the [startTime, endTime) window, excluding those that are already present (to make this pipeline idempotent when running with the same parameters multiple times, either in parallel or in sequence). The BillingRecurrence is also updated with the information on when it was last expanded, so it would not be in scope for expansion until at least a year later.
  • If the cursor for billing events should be advanced, advance it to endTime after all of the expansions in the previous step is done, only when it is currently at startTime.

Note that the creation of new BillingEvent and DomainHistory is done speculatively as soon as its event time is in scope for expansion (i.e. within the window of operation). If a domain is subsequently cancelled during the autorenew grace period, a BillingCancellation would have been created to cancel the BillingEvent out. Similarly, a DomainHistory for the delete will be created which negates the effect of the speculatively created DomainHistory, specifically for the transaction records. Both the BillingEvent and DomainHistory will only be used (and cancelled out) when the billing time becomes effective, which is after the grace period, when the cancellations would have been written, if need be. This is no different from what we do with manual renewals or normal creates, where entities are always created for the action regardless of whether their effects will be negated later due to subsequent actions within respective grace periods.

To stage this template locally, run ./nom_build :core:sBP --environment=alpha \ --pipeline=expandBilling.

Then, you can run the staged template via the API client library, gCloud or a raw REST call.

See Also:
  • Method Details

    • main

      public static void main(String[] args)