1

I need to be notified on the following events:

LightningUriEventStream
LoginAsEventStream
LoginEventStream
ReportAnomalyEvent
SessionHijackingEvent

I know in LWC and Aura components I can use the emp API to get notified etc. However I need to have some options in Apex. Doing some research I see that one can do Apex triggers on events as mentioned here: https://help.salesforce.com/s/articleView?id=sf.security_auth_create_logout_event_trigger.htm&type=5

Is this the only way to subscribe to events in Apex?

2 Answers 2

3

Yes, Apex triggers are the way to go. The streaming APIs rely on the CometD protocol and there is no CometD client available in Apex.

1

You can also use Transaction Security Policy for getting notifications on real-time events. Refer:Transaction Security Policies

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .