Edit in GitHubLog an issue

Configure Adobe Commerce

After you have created an App Builder project and install the eventing modules, you must download several files from the App Builder project and configure eventing in the Commerce admin.

Configure the Adobe I/O connection

You must configure Commerce to communicate with your project. Configuration includes copying and pasting the contents of the workspace configuration file that you downloaded from the Adobe Developer Console. If you decided to use JSON Web Tokens (JWT) as your server-to server authentication method, you must also upload a private key.

  1. In the Commerce Admin, navigate to Stores > Settings > Configuration > Adobe Services > Adobe I/O Events > General configuration. The following screen displays.

    General configuration

  2. Select the server-to-server authorization method you implemented from the Adobe I/O Authorization Type menu. Adobe recommends using OAuth. JWT has been deprecated.

  3. (JWT only) Copy and paste the contents of your private.key file into the Service Account Private Key field. Use the following command to copy the contents.

    Copied to your clipboard
    cat config/private.key | pbcopy

    See Service Account (JWT) Authentication for more information about the private.key file.

  4. Copy the contents of the <workspace-name>.json file into the Adobe I/O Workspace Configuration field.

  5. Enter a unique identifier in the Adobe Commerce Instance ID field. This value must contain English alphanumeric characters, underscores (_), and hyphens (-) only.

  6. Click Save Config, but do not leave the page. The next section creates an event provider, which is necessary to complete the configuration.

Create an event provider and complete the Commerce configuration

You cannot create an event provider until you have configured and saved a workspace file and instance ID values. If you are using JWT for server-to-server authentication, you must also have previously specified the private key.

  1. Run the following command to create an event provider:

    Copied to your clipboard
    bin/magento events:create-event-provider --label "<unique_provider_label>" --description "<provider description>"

    For example:

    Copied to your clipboard
    bin/magento events:create-event-provider --label "My_server_provider" --description "Provides out-of-process extensibility for Adobe Commerce"

    Note: The label can contain English alphanumeric characters and underscores (_) only. The first character must be a letter.

    The command displays a message similar to the following:

    Copied to your clipboard
    No event provider found, a new event provider will be created
    A new event provider has been created with ID 63a1f8fe-e911-45a4-9d3f
  2. Copy the ID returned in the command output into the Adobe I/O Event Provider ID field in the Admin.

    Commerce events configuration

  3. Enable Commerce Eventing by setting Enabled to Yes.

    Note: You must enable cron so that Commerce can send events to the endpoint.

  4. Enter the merchant's company name in the Merchant ID field. You must use alphanumeric and underscores only.

  5. In the Environment ID field, enter a temporary name for your workspaces while you are in development mode. When you are ready for production, change this value to a permanent value, such as Production.

  6. (Optional) By default, if an error occurs when Adobe Commerce attempts to send an event to Adobe I/O, Commerce retries a maximum of seven times. To change this value, uncheck the Use system value checkbox and set a new value in the Maximum retries to send events field.

  7. (Optional) By default, Adobe Commerce runs a cron job (clean_event_data) every 24 hours that deletes event data that is three days old. To change the number of days to retain event data, uncheck the Use system value checkbox and set a new value in the Event retention time (in days) field.

  8. Click Save Config.

After you have completely configured and saved your Adobe I/O event connection and your event provider, you can click the Send Test Event button to determine the status of the connection. The response displays beneath the button.

Subscribe and register events

You must define which Commerce events to subscribe to, then register them in the project.

Commerce provides two sources for events: observers and plugins. You must specify the source as part of the event name. See Subscribe to a Commerce event for details about the syntax of the events:subscribe command.

  1. If you don't have a module ready for integration with Adobe I/O Events, or you don't know exactly which events to register at this point, use the events:subscribe command to subscribe to some sample events, as shown in the following example commands:

    Copied to your clipboard
    bin/magento events:subscribe observer.catalog_product_save_after --fields=sku --fields=stock_data.qty
    Copied to your clipboard
    bin/magento events:subscribe observer.customer_login --fields=firstname --fields=lastname --fields=entity_id

    Warning: When you use the events:subscribe command to subscribe to events on a Cloud environment, configuration information is stored in the app/etc/config.php file. You must keep in mind that this file can be replaced with the app/etc/config.php file from Git during deployment. As a result, the event subscription will be replaced as well. To make these changes permanent, manually add the appropriate configuration to the app/etc/config.php file under Git.

    If you have a module ready or have specific events in mind, see Register events for more information.

  2. Return to your workspace. Click the Add service pop-up menu and select Event.

    Click Add service in your workspace

  3. On the Add events page, select Commerce events. Then click Next.

    Select Commerce events

    Note: If the Commerce events category is not shown, check that you have created an event provider, and that it has at least one subscribed event. You may need to run the bin/magento events:metadata:populate command to synchronize event registrations in Adobe Commerce with the created event provider.

  4. On the Configure event registration page, select your event provider. Then click Next.

  5. Select the events to subscribe to. Then click Next.

    Select the events to subscribe to

  6. Optionally create a new OAuth or JWT credential. Then click Next.

  7. Update the Event registration name and Event registration description fields. In the How to receive events section, under Option 2, select the runtime action you created in Set up App Builder and define a runtime action.

    Select a runtime action

  8. Select Save configured events.

You are now set up to develop your App Builder extension.

Check cron and message queue configuration

Cron and message queues must be enabled. Commerce uses the event_data_batch_send cron job to transmit batches of event messages and the clean_event_data cron job to remove these messages from the database. These cron jobs are part of the default group.

The commerce.eventing.event.publish message queue consumer helps expedite registered events that have been designated as priority. The consumer processes priority events within a second of their receipt. By default, it can take up to 59 seconds for cron to process standard-priority events.

In Adobe Commerce on cloud infrastructure, update your .magento.env.yaml file with the following changes to the global and deploy stages:

Copied to your clipboard
stage:
global:
ENABLE_EVENTING: true
deploy:
CRON_CONSUMERS_RUNNER:
cron_run: true
max_messages: 0
consumers: []

See Global variables for more information about the ENABLE_EVENTING variable.

Cloud infrastructure and on-premises instances require different cron management procedures as described here:

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.