2024.1 Server Configuration
The NetSuite Connector works by utilizing queues. Queues are pulled and managed from the CLI. Therefore, for the Connector to function properly, it is required to have the crond service installed and set up at the server (https://man7.org/linux/man-pages/man8/crond.8.html).
The main NetSuite processing CLI command to pull and to process Queues is a bin/magento netsuite:cron command. The elementary cron entry to make the NSC Queue work is explained below:
*/2 * * * * php __ROOT_PATH__/bin/magento netsuite:cron --mode all > /dev/null 2>&1
The command can be explained as follows:
- */2 * * * * - standard crond time expression. For possible options see https://crontab.guru/
- php __ROO_PATH__/bin/magento netsuite:cron --mode all - CLI command to be executed.
- > /dev/null 2>&1 - part of command that removes all output.
The command from the example above will take care of all NetSuite synchronization: It grabs product changes and stock levels, exports orders, imports invoices etc. Since this is single-threaded, it might be relatively slow. However, the bin/magento netsuite:cron command has other modes to operate. These modes are:
- Export - takes care of the exporting processes. The system picks up all messages and sends them to NetSuite (see details: 2024.1 Technical documentation).
- Import - takes care of the importing processes. The system pulls data from the import queue, processes it, pulls data from NetSuite, and puts it into queue (see details: 2024.1 Technical documentation).
- importToQueue - In this sub-process option, the system only pulls data from NetSuite, and puts it into queue (see details: 2024.1 Technical documentation).
- processQueue - in this sub-process option, the system only pulls data from the import queue, and then processes it (see details: 2024.1 Technical documentation).
- stock - takes care of stock updates (see details: 2024.1 Technical documentation)
- location - takes care of source creation from locations and their updating (see details: 2024.1 Technical documentation)
And B2B specific modes:
- find_recalculation - shared catalogs pricing recalculations (see details: 2024.1 Technical documentation)
- recalculate - shared pricing recalculations (see details: 2024.1 Technical documentation)
The modes can be combined with a comma. Here is an example that runs different processes in parallel:
*/5 * * * * php /home/dev/public_html/oDaBS2962/bin/magento netsuite:cron --mode importToQueue > /dev/null 2>&1 */2 * * * * php /home/dev/public_html/oDaBS2962/bin/magento netsuite:cron --mode processQueue > /dev/null 2>&1 */5 * * * * php /home/dev/public_html/oDaBS2962/bin/magento netsuite:cron --mode export > /dev/null 2>&1 */30 * * * * php /home/dev/public_html/oDaBS2962/bin/magento netsuite:cron --mode stock > /dev/null 2>&1
Important Note
You can try to play with different cron command settings in the range of your project requirements. That said, typically, separating all processes is a much more efficient way to NSC operating. Also, splitting the import into 2 steps (importToQueue and process Queue) is useful in case of a huge amount of NetSuite changes for importing entities. For small projects and Dev/Staging environments, it is not required to do such splitting.
Note that NetSuite can use up to 4 simultaneous connections with one token. If your organization plans to use more than four at the same time, your company might need to consider separate connections for different process setups (see Separate Connection Configuration for Export, Import, and Stock: 2024.1 General settings).