Broadleaf Microservices
  • v1.0.0-latest-prod

Product Bulk Operations

Overview

These Bulk Operations are created & handled in Catalog after being processed by the newly added Bulk Operations orchestration service.

Out-of-the-box, there are four bulk operations that are supported on products. The BulkOpeartion#operationType value used for these operations is configured in each processor.

These implementations can be found as extensions of the CatalogService interface BulkUpdateProcessor, and are detailed in the "Processors" section below.

Key Components

BulkUpdateProcessor

The BulkUpdateProcessor is the interface responsible for processing bulk updates based on the operation type and entity type. Each implementation of this class should specify a specific operation type that it can handle.

BulkUpdateProcessorHelper

This class contains the common components shared between the processors & manages batching of bulk operation items. It’s also responsible for keeping the bulk operation & the bulk operation item states updated during processing, i.e. persisting updates to success/error counts & statuses.

BulkItemPageOperator

This operator is a functional interface that allow processing against a batch of bulk operation items. This is called by the BulkUpdateProcessorHelper to simplify the shared processing logic between processors.

PurgeBulkOperationHandler

This handler is responsible for processing the Purge Bulk Job, PURGE_BULK_OPERATION_DATA. This is needed to remove old records from the Bulk Operation & Bulk Operation Item tables, and prevent data buildup. By default, this only looks to remove completed bulk operations, but this can be configured to include other statuses with a purgeBulkOperationStatuses job detail.

Job Details

Job Detail Key Type Default Value Description

purgeBulkOperationThreshold

Duration

30d

Bulk Operations that have not been updated for this amount of time are subject to removal. This is parsed with Spring’s DurationStyle, so either ISO-8601 formatting or simple formatting can be used.

purgeBulkOperationBatchSize

Integer

25

The number of bulk operations to purge in a single batch.

purgeBulkOperationItemBatchSize

Integer

100

he number of bulk operation items to purge in a single batch.

purgeBulkOperationStatuses

Comma-separated list

COMPLETE

List of bulk operation statuses to be purged

Example Purge Bulk Ops Job SQL

The following sql snippet would configure a job to run every day at 3AM to delete bulk operations & bulk operation items that have not been updated in 30 days with the status "COMPLETE".

-- purge bulk operation data scheduled job
INSERT INTO BLC_SCHEDULED_JOB (ID, TYPE, TIMING_TYPE, NAME, ENABLED, EXECUTED, CRON,
                               MANAGE_IN_ADMIN, TRK_TENANT_ID, TRK_ARCHIVED, TRK_CHANGE_DETAILS)
VALUES ('PURGE_BULK_OPERATION_DATA', 'PURGE_BULK_OPERATION_DATA', 'CRON',
        'Purge old Bulk Operations and Items', 'Y', 'N', '0 0 3 * * ? *', 'Y',
        '5DF1363059675161A85F576D', 'N', '[]');
INSERT INTO BLC_SCHEDULED_JOB_DETAIL (JOB_ID, NAME, VALUE, VALUE_SHA, DETAILS_ORDER)
VALUES ('PURGE_BULK_OPERATION_DATA', 'purgeBulkOperationThreshold', '30d',
        'dccf34aa1f3e476c3d6ebdb7fa90c2850c88570f', 0),
       ('PURGE_BULK_OPERATION_DATA', 'purgeBulkOperationBatchSize', '25',
        'f6e1126cedebf23e1463aee73f9df08783640400', 1),
       ('PURGE_BULK_OPERATION_DATA', 'purgeBulkOperationItemBatchSize', '100',
        '310b86e0b62b828562fc91c7be5380a992b2786a', 2),
       ('PURGE_BULK_OPERATION_DATA', 'purgeBulkOperationStatuses', 'COMPLETE',
        '2c85a73cd12db61768b9bb19ea9828e95032a59a', 3);

Processors

SetActiveProductBulkUpdateProcessor

The operation type for this processor is SET_ACTIVE_PRODUCT.

This processor can update the active start date, active end date, and online flag for a list of products. This data is pulled from the BulkOperation#operationData and is set for every product entity referenced by the Bulk Operation Items.

ArchiveProductBulkUpdateProcessor

The operation type for this processor is ARCHIVE_PRODUCT.

This processor archives all products specified by the entity context ID on the Bulk Operation Items.

AddTagsProductBulkUpdateProcessor

The operation type for this processor is ADD_TAGS.

This processor adds all tags (optionally, with active start/end dates) specified in the BulkOperation#operationData to each product referenced by the entity context ID on the Bulk Operation Items.

RemoveTagsProductBulkUpdateProcessor

The operation type for this processor is REMOVE_TAGS.

This processor removes all tags specified in the BulkOperation#operationData from each product referenced by the entity context ID on the Bulk Operation Items. If the product does not contain any of the tags specified, no updates are made to the product. If the product only contains a subset of the tags specified, those tags are removed from the product.