Overview of bulk insert work queues
If your type of process works extremely large work batches, it is possible for the WorkQueueBase.findTargets method to return an iterator that exceeds the memory capacity of the work queue server. In some cases, the method returns an iterator for batches that typically number hundreds of thousands of units of work.
Thus, Guidewire recommends that you implement
your custom work queue as a class that extends BulkInsertWorkQueueBase instead
of WorkQueueBase. In your
class, implement the BulkInsertWorkQueuBase.buildBulkInsertSelect
method for your query logic, instead of the WorkQueueBase.findTargets method.
PolicyCenter calls the buildBulkInsertSelect method with a query object that has no restrictions on the target entity type that you specify in the class constructor. However, bulk insert work queues support standard work items only. Thus, do not attempt to use custom fields on work items to pass any data other than target entity instances to the workers of your bulk insert work queue.
Use the query builder APIs in your code
to add restrictions, including restrictions based on joins, that select
the targets for a batch. After your code returns from buildBulkInsertSelect, PolicyCenter submits a SELECT statement based on the
query object directly to the database. The database then uses its native
bulk insert capabilities to insert standard work items for the batch
directly into the standard work queue table.
Bulk insert work queues are suitable if you can reduce the selection criteria for the targeted units of work to a single query builder query object. Because PolicyCenter creates and inserts work items at the database level, it is not necessary to implement the following methods:
createWorkItemshouldProcessItem
The BulkInsertWorkQueuBase
base class is a subclass of WorkQueuBase,
so you must also implement method processWorkItem
for the worker logic of a bulk insert work queue.
