I have requirement to subscribe salesforce platform events in external systems(adobeConnect) and display event notifications.
For that I have a trigger to publishing the platform events and I wrote a REST api class to subscribe events.
Trigger :
trigger MeetingTrigger on AdobeMeeting__c (after update) {
List<lightningdeve__Meeting__e> OrdEvents = New List<lightningdeve__Meeting__e>();
for (AdobeMeeting__c o: Trigger.new) {
if(o.lightningdeve__Status__c == 'NotStarted'){
OrdEvents.add(new lightningdeve__Meeting__e( lightningdeve__Type__c=o.lightningdeve__Status__c));
}
}
if(OrdEvents.size()>0)
EventBus.publish(OrdEvents);
REST api to subscribe platform event
public class SubscribePlatformEventsChannel {
public static HttpResponse getEventInformation() {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(System.URL.getOrgDomainUrl().toExternalForm() + '/event/lightningdeve__Meeting__e');
request.setMethod('GET');
HttpResponse response = http.send(request);
System.debug('Response:::'+response.getBody());
return response;
}
This is the right way to subscribe platform events ?
or suggest any other possibilies to suitable to my requirement.
Thanks