Skip to content

Job Queue Channels

The channels are implemented in the cnf_queue_job module. If you wish to associate your method with a channel, your module must inherit the cnf_queue_job module, and you'll need to create an XML queue.job.function record in your module.

Available Channels

root

root is the base channel. Methods that do not have a configured channel will go here by default. It is strongly recommended to not dispatch jobs in the root channel as jobs dispatched to it will run at the full capacity.

root.batch

root.batch is a narrow channel designed for batching many API requests without DDOSing the source.

Use this channel if: - You will have a number of batches that query the same API - You will have a number of high memory or CPU intensive jobs

root.record

root.record is a wide channel designed for batching low resource updates and inserts of API data into the database.

Use this channel if: - You will have a number of jobs with low memory or CPU requirements - Are inserting or updating records

root.salessession

root.salessession is a tiny 1 worker channel designed for tasks that should run one at a time to prevent concurrency issues. This channel is used for posting the many accounting entries generated by the PRATS sync process.

Use this channel if: - The jobs you are creating are consistently retrying due to concurrency errors when using a bigger channel

root.stockvalidation

Uses the same width of the root.record channel, but organizes stock move validation away from record imports.

root.stockvalidation.compute

Not implemented, not in use.

Configuring Channel Usage

To configure your method to use a specific channel, define an XML record in your module:

<record id="job_function_sale_import_record" model="queue.job.function">
    <field name="model_id" ref="connector_cnf_inventory.model_cnf_pos_order" />
    <field name="method">import_record</field>
    <field name="channel_id" ref="cnf_queue_job.channel_record" />
    <field name="related_action" eval='{"func_name": "custom_related_action"}' />
    <field name="retry_pattern" eval="{1: 60, 2: 180, 3: 10, 5: 300}" />
</record>

Channel Selection Guidelines

When choosing a channel for your job:

  1. High-volume, low-resource operations → root.record
  2. API batching or CPU-intensive tasks → root.batch
  3. Sequential processing required → root.salessession
  4. Stock-related validations → root.stockvalidation
  5. Default/uncategorized → Avoid root, choose appropriate specific channel

For more detailed best practices on using job queues and channels, see Connector and Job Queue Best Practices.