-
Task
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
None
-
False
-
-
False
-
-
The workflow would look like as:
- Get remittances with status pending in batches ordered by the "BillableUsageAggregateKey" class and remittance_pending_date and filter out the records older than a concrete amount of time defined in configuration.
- If the usage has billing provider Red Hat
- Update the usage to status “In Progress” and updated_at to now()
- Transform the usage entity to the usage message
- Send the usage message to the platform.rhsm-subscriptions.billable-usage topic
- If the above transaction fails, update the records to "Pending" status
- If the above transaction works, update the records to “Sent” status.
- If the usage has billing provider AWS or Azure
- Aggregate the usage into the hourly aggregate message
- Send aggregations to the “platform.rhsm-subscriptions.billable-usage-hourly-aggregate” topic
- If the above transaction fails, update the records to "Pending" status
- If the above transaction works, update the records to “Sent” status.
Changes
- Add a new configuration property in the billable usage service to limit how long time we will query the usages (default value is 7 days?). So, pending usages older than 7 days will not be reprocessed.
New Tests to add
Given existing pending remittance entities for all the billing providers,
When the running hourly aggregation
And the existing pending remittance change to “In Progress” status
And the billable usage service is shutdown before sending the aggregation to the topic
Then after running the daily clean up process, these entities are in “Pending” status
Given existing pending remittance entities, When the running hourly aggregation And the existing pending remittance change to “In Progress” status And the billable usage service is shutdown after sending the aggregation to the topic And the SWATCH producers handle the sent aggregation and send a message to update the status Then after running the daily clean up process, these entities are NOT in “Pending” status
Given existing pending remittance entities,
When the running hourly aggregation
And the existing pending remittance change to “Sent” status
And the SWATCH producers do not handle the sent aggregation
Then after running the daily clean up process, these entities are in “Unknown” status
Given existing In Progress remittance with value “2” And pending remittance for the same key with value “4” When running the hourly aggregation Then only the remittance for the same key with value “4” is processed
Given existing In Progress remittance with value “2”
And pending remittance for the same key with value “4”
And the daily clean up process updates the status from “In Progress” to “pending”
When running the hourly aggregation
Then aggregated remittance has value “4”
- depends on
-
SWATCH-3235 New Billable Usage API to reset status of remittance entities
-
- Release Pending
-
- is depended on by
-
SWATCH-3241 Verify failover scenarios
-
- Backlog
-
-
SWATCH-3242 New CronJob to trigger the Billable Usage API to perform hourly aggregation
-
- Backlog
-
-
SWATCH-3243 Update the tally summary consumer to not send to the platform.rhsm-subscriptions.billable-usage
-
- Backlog
-