Newer Version Available
Subscribe to the Channel
After creating the custom channel and its members, subscribe to the channel using a
CometD client, and receive event messages. Only CometD clients support custom channels. Other
subscribers, such as Apex triggers, flows, and processes, don’t support custom
channels.
-
To set up EMP Connector, follow the steps in Example: Subscribe to Events Using a CometD Client (EMP Connector). For the channel argument, provide the custom channel
that you created: /event/Order_Channel__chn. The
channel name is format /event/ChannelName__chn.
-
Now that you’re subscribed to the custom channel, publish event messages of both events,
Order_NorthAmer__e and Order_EMEA__e, in the Developer Console using Apex.
- In Salesforce Classic, select .
- In Lightning Experience, click the quick access menu, and select Developer Console.
- Select .
-
In the new window, replace the contents with this Apex code snippet, and click
Execute.
Because Order_Channel__chn includes both the Order_NorthAmer__e and Order_EMEA__e event types, you receive the event messages of both events. This example shows the two received event messages after subscribing to the filtered channel, /event/Order_Channel__chn.