CLI tool to consume platform events from a Salesforce org.
Install the CLI tool using yarn or npm:
yarn add global platform-event-consumer
The script accepts different arguments:
-e, --event <event>
: Event that we want to consume.-u, --username <username>
(Optional): Username of the Salesforce org from which we want to consume events. You will need to authenticate to that org first using SFDX.--env
(Optional): if set, the script will get the authentication configuration from the enviromnent variables (see.env
file).
In order to consume events in this way, you will need to have SFDX installed in your machine and authorize the org you want to consume events from using any of the auth commands.
platform-event-consumer --event Test_Event__e --username username@test.com
If you don't have SFDX installed in your machine, you can authenticate to any org using OAuth. All the necessary environment variables are listed in the .env
file.
Once you have set them up, you can just run:
platform-event-consumer --event Test_Event__e --env