I created a Mule app that takes data from some json feeds and transforms them with a custom transformer I made to create a class.
I have a parent class Event
and two subclasses that inherit from it: Event1
and Event2
. The return class of my custom transformer (auto-transformer
) is Event
.
I am using a choice flow control component so when a certain data value is reached for the Event1
a mail is sent, and when a certain data value is reached for Event2
a different mail is sent.
In Event1
I defined the method getThisData()
and in Event2
I defined getThatData()
.
When I use #[payload.getThisData()]
everything works, the value is checked, and the mail is sent if the condition is true.
However, for the Event2
branch it doesn't work. It gives me an error. It tries to look for the getThatData()
in the Event1
class, and obviously it does not exist.
How can I fix this? How can I get the value from getThatData()
?
I use Mule Studio.
<processor-chain>
<auto-transformer returnClass="events.Event" name="JSONToEvent"></auto-transformer>
<logger level="INFO" doc:name="Logger"/>
<choice doc:name="Choice">
<when expression="#[payload.getThisData()>1200]">
<twitter:update-status config-ref="Twitter" status="Value reached"/>
</when>
<when expression="#[payload.getThatData()>11]">
<twitter:update-status config-ref="Twitter" status="The other value reached"/>
</when>
<otherwise>
<twitter:update-status config-ref="Twitter" status="#[payload]" doc:name="Normal"/>
</otherwise>
</choice>
</processor-chain>