A custom logger Mule XML SDK module is being developed to log the current payload in a particular format. Which code syntax is required to automatically accept the payload as a parameter to an XML SDK operation?

Prepare for the MuleSoft Developer 2 Certification Exam. Access practice quizzes featuring flashcards and multiple choice questions with explanations. Get confident and ready for your certification success!

Multiple Choice

A custom logger Mule XML SDK module is being developed to log the current payload in a particular format. Which code syntax is required to automatically accept the payload as a parameter to an XML SDK operation?

Explanation:
In Mule XML SDK, the payload must be bound as the operation’s main input. To have the current message payload automatically passed to the operation, declare a parameter named payload and mark its role as PRIMARY. This designation tells the SDK that this parameter represents the main input to the operation, so the runtime injects the current payload automatically (which is exactly what you want for a logger to format the current payload). Using a different name or a non-primary role would not bind the inbound payload automatically, since secondary inputs are for additional data and the default role does not indicate the primary payload binding. Therefore, the required syntax is a parameter named payload with role set to PRIMARY.

In Mule XML SDK, the payload must be bound as the operation’s main input. To have the current message payload automatically passed to the operation, declare a parameter named payload and mark its role as PRIMARY. This designation tells the SDK that this parameter represents the main input to the operation, so the runtime injects the current payload automatically (which is exactly what you want for a logger to format the current payload). Using a different name or a non-primary role would not bind the inbound payload automatically, since secondary inputs are for additional data and the default role does not indicate the primary payload binding. Therefore, the required syntax is a parameter named payload with role set to PRIMARY.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy