Class ExpandRecurringBillingEventsPipeline
- java.lang.Object
-
- google.registry.beam.billing.ExpandRecurringBillingEventsPipeline
-
- All Implemented Interfaces:
java.io.Serializable
public class ExpandRecurringBillingEventsPipeline extends java.lang.Object implements java.io.Serializable
Definition of a Dataflow Flex pipeline template, which expandsBillingEvent.Recurring
toBillingEvent.OneTime
when an autorenew occurs within the given time frame.This pipeline works in three stages:
- Gather the
BillingEvent.Recurring
s that are in scope for expansion. The exact condition ofBillingEvent.Recurring
s to include can be found ingetRecurringsInScope(Pipeline)
. - Expand the
BillingEvent.Recurring
s toBillingEvent.OneTime
(and correspondingDomainHistory
) 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). TheBillingEvent.Recurring
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 atstartTime
.
Note that the creation of new
BillingEvent.OneTime
andDomainHistory
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, aBillingEvent.Cancellation
would have been created to cancel theBillingEvent.OneTime
out. Similarly, aDomainHistory
for the delete will be created which negates the effect of the speculatively createdDomainHistory
, specifically for the transaction records. Both theBillingEvent.OneTime
andDomainHistory
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:
BillingEvent.Cancellation.forGracePeriod(google.registry.model.domain.GracePeriod, org.joda.time.DateTime, google.registry.model.reporting.HistoryEntry.HistoryEntryId, java.lang.String)
,DomainFlowUtils.createCancelingRecords(google.registry.model.domain.Domain, org.joda.time.DateTime, org.joda.time.Duration, com.google.common.collect.ImmutableSet<google.registry.model.reporting.DomainTransactionRecord.TransactionReportField>)
, Using Flex Templates, Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
-