The Batch API provides a way to create or update a list of entities of the same type via one API request.
By default, Batch API is disabled for all API resources. To enable it for an API resource,
the update_list action should be enabled for this resource.
You can do this via
actions section for an entity in Resources/config/oro/api.yml.
All configuration options related to Batch API are grouped in the
batch_api section of ApiBundle configuration:
# The default maximum number of entities that can be saved in a chunk. The default value is 100.
# The maximum number of entities of a specific type that can be saved in a chunk.
Oro\Bundle\UserBundle\Entity\User: 10 # example
# The default maximum number of included entities that can be saved in a chunk. The default value is 50.
# The maximum number of included entities that can be saved in a chunk for a specific primary entity type.
Oro\Bundle\UserBundle\Entity\User: 20 # example
included_data_chunk_size_per_entity can be used to tuning of
an API engine to have maximum performance.
To get maximum performance in requests with included entities, you can change the value of the
parameter to the medium number of related entities that will be set to one primary entity when processing the request.
Obsolete asynchronous batch operations are removed once a day by a cron job.
The default configuration of this cron job is illustrated below:
# The number of days async operations are stored in the system.
# The maximum number of seconds that the cron job can spend in one run.
cleanup_process_timeout: 3600 # 1 hour
# The maximum number of seconds after which an operation will be removed regardless of status.
operation_timeout: 3600 # 1 hour
The KnpGaufretteBundle is used to configure storages for source data files of Batch API requests and all files created when processing asynchronous batch operations (e.g., chunk files, error files, etc.).
Here is the default configuration of these storages:
# a storage for source data files
# a storage for files created when processing asynchronous batch operations
To change the adapter configuration, use Resources/config/oro/app.yml in any application bundle or config/config.yml. The following example shows how to reconfigure this adapter to use a local filesystem:
You can find more examples in KnpGaufretteBundle documentation.
Explore our guide to learn how digital transformation in manufacturing industry improves operations, customer experiences, and sales.