ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 16 - AD0-E722 discussion

Report
Export

An Adobe Commerce Architect needs to log the result of a ServiceClass:: getData method execution after all plugins have executed. The method is public, and there are a few plugins declared for this method. Among those plugins are after and around types, and all have sortOrder specified.

Which solution should be used to meet this requirement?

A.
Declare a new plugin with the sortOrder value lower than the lowest declared plugin sortOrder and implement aroundGetData method.
Answers
A.
Declare a new plugin with the sortOrder value lower than the lowest declared plugin sortOrder and implement aroundGetData method.
B.
Declare a new plugin with the sortOrder value higher than the highest declared plugin sortOrder and implement afterGetData method.
Answers
B.
Declare a new plugin with the sortOrder value higher than the highest declared plugin sortOrder and implement afterGetData method.
C.
Declare a new plugin with the sortOrder value higher than the highest declared plugin sortOrder and implement aroundGetData method.
Answers
C.
Declare a new plugin with the sortOrder value higher than the highest declared plugin sortOrder and implement aroundGetData method.
Suggested answer: B

Explanation:

This solution ensures that the new plugin will execute after all the existing plugins for the ServiceClass::getData method, and will be able to log the final result of the method execution. The afterGetData method of the new plugin will receive the result of the method as a parameter, and can use any logging mechanism to record it. The sortOrder value of the new plugin should be higher than the highest declared plugin sortOrder, so that it will run last in the sequence of plugins. The after type of plugin is preferred over the around type of plugin, because it is simpler and more efficient, and does not require calling the proceed() method.

Plugins (Interceptors) | Adobe Commerce Developer Guide

Plugin best practices | Adobe Commerce Developer Guide

asked 02/10/2024
Ronald Buffing
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first