Universal Containers は、未処理の例外が発生した場合に、Apex を使用してカスタムイベントを公開することで外部システムに通知したいと考えています。
この要件を満たす適切なパブリッシュ/サブスクライブ ロジックは何ですか?
正解:A
The appropriate publish/subscribe logic to meet this requirement is to publish the error event using the EventBus.publish() method and have the external system subscribe to the event using CometD. The EventBus.publish() method allows the developer to publish a custom event using Apex, and specify the event type, payload, and channel. The external system can use CometD, which is a scalable HTTP-based event routing bus, to subscribe to the event channel and receive the event notifications. The addError() method is not a valid answer, as it is used to display a custom error message on a record or a field, but it does not publish an event. The without keyword is not a valid answer, as it is used to ignore the sharing rules and permissions of the current user when accessing the records, but it does not affect the event publishing or subscribing. The event channel is not a valid answer, as it is the name of the channel that the event is published to or subscribed from, but it does not initiate the publish/subscribe logic by itself. Reference: [Publish and Subscribe to Platform Events Using Apex], [Subscribe to Platform Events Using CometD], [Apex Developer Guide]