0

enter image description here

I am trying to retrieve names of employees from the database by calling a stored procedure and logging it. But Instead of the names , this is the output of the log:

INFO  2019-12-11 11:48:39,994 [[MuleRuntime].cpuLight.10: [testrun].testrunFlow.CPU_LITE @3bc66a50] [event: 0-12970c00-1bde-11ea-92a5-38dead78b440] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 
org.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation
{
  payload=org.mule.extension.db.internal.result.statement.CloseableMap@8194c34
  mediaType=application/java; charset=UTF-8
  attributes=<not set>
  attributesMediaType=*/*
}

what changes can I make so that I recieve the list of names from db.

HMT
  • 2,093
  • 1
  • 19
  • 51

1 Answers1

1

your database connector by defaults returns a resultset. convert your resultset into a json by adding a transformer after DB call and set output type to json. if you want only one particular field then you need to have your transform done accordingly

enter image description here

enter image description here

as you can see in your logger that its mentioned the payload type payload=org.mule.extension.db.internal.result.statement.CloseableMap@8194c34

that is the internal representation of the result set read back from the stored procedure. so just convert it into json or whatever format you want. Put a transform message component after DB call and do the following:

%dw 2.0
output application/json
---
payload

if you want any particular field or something then you can see how your payload is getting structured and do the dataweave accordingly

satish chennupati
  • 2,602
  • 1
  • 18
  • 27
  • can you please answer this question also ?https://stackoverflow.com/questions/59318278/validation-of-payload-in-esb. I would appreciate any help. Thanks. – HMT Dec 13 '19 at 08:51