Nuxeo Server

Bulk Action Framework

Updated: August 21, 2018 Page Information Edit on GitHub

The Bulk Action Framework provides a service to be able to run resilient bulk actions on a possibly large set of documents.

This framework introduces the notion of action, which is an operation to apply on a set of documents, and the notion of bulk command. A command is composed of multiple parameters, the most important ones being the action to execute and the NXQL query which materializes the document set. More details are available in GitHub.

Bulk Service

This service provides ways to:

  • Submit a command to be executed.
  • Get the status of a submitted command.
  • Wait for a command to be completely executed.
  • Wait for all running commands to be completely executed (for tests).

The following is an example of use of bulk service:

// build command
BulkCommand command = new BulkCommand().withRepository("default")
                                       .withQuery("SELECT * from Document")
                                       .withParam("dc:nature", "article")
                                       .withParam("dc:subjects", singletonList("art/architecture"));

// run command
BulkService bulkService = Framework.getService(BulkService.class);
String commandId = bulkService.submit(command);

// await end of computation
bulkService.await(commandId, ofMinutes(1));

// get status
BulkStatus status = bulkService.getStatus(commandId);

Bulk Automation Operation

It is possible to submit a command through the Bulk.RunAction automation operation.

This is a temporary operation, it will be removed for LTS 2018.

The following is an example of use of operation:

curl -X POST -H 'Content-Type: application/json' -u Administrator:Administrator \
    http://localhost:8080/nuxeo/api/v1/automation/Bulk.RunAction \
    -d '{
                "query":"SELECT * FROM Document",

Contributing an Action

You need to register a couple action/stream processor:

<extension target="org.nuxeo.ecm.core.bulk" point="actions">
  <action name="myAction"/>

<extension target="" point="streamProcessor">
  <streamProcessor name="myAction" class="org.nuxeo.ecm.core.bulk.actions.MyActionProcessor" logConfig="bulk"
      defaultConcurrency="1" defaultPartitions="1">

It is possible to add several options to the stream processor to tune the way the documents are processed. Please visit nuxeo-runtime-stream README for more information.

2 months ago manonlumeau NXDOC-1638: Add a BAF actions directory page
3 months ago manonlumeau NXDOC-1582: add Bulk Action Framework documentation
3 months ago manonlumeau Fix formatting
History: Created by manonlumeau

We'd love to hear your thoughts!

All fields required