nerdexam
MuleSoft

MCD-LEVEL-1 · Question #15

What is the correct syntax for a Logger component to output a message with the contents of a 3SON Object payload?

The correct answer is B. #["The payload is: " ++ payload]. Option 3 is the only corect answer as it concatenates payload with String. Below option wont work. #["The payload is " ++ payload] Concatenation function expects both arguments to be string. As the question says payload is json object , this will throw error while running it…

Mule 4 Application Development

Question

What is the correct syntax for a Logger component to output a message with the contents of a 3SON Object payload?

Options

  • AThe payload is: $(payload)
  • B#["The payload is: " ++ payload]
  • CThe payload is: #[payload]
  • D#["The payload is: " + payload]

How the community answered

(27 responses)
  • A
    7% (2)
  • B
    85% (23)
  • C
    4% (1)
  • D
    4% (1)

Explanation

Option 3 is the only corect answer as it concatenates payload with String. Below option wont work. #["The payload is " ++ payload] Concatenation function expects both arguments to be string. As the question says payload is json object , this will throw error while running it. You can try this in Anypoint Studio and you will get the same result which I mentioned. hence correct answer is The payload is: #[payload]

Topics

#Logger component#DataWeave inline expression#string concatenation#MEL vs DataWeave

Community Discussion

No community discussion yet for this question.

Full MCD-LEVEL-1 Practice