How to read <object-to-string-transformer doc:name="Object to String"/>
in java class.
my configuration is:
<flow name="file-processFlow3" doc:name="file-processFlow3">
<jms:inbound-endpoint doc:name="JMS" queue="OrchestratorQueue" connector-ref="Active_MQ1" responseTimeout="0" >
<jms:transaction action="ALWAYS_BEGIN" timeout="10000"/>
</jms:inbound-endpoint>
<object-to-string-transformer doc:name="Object to String"/>
<component doc:name="Java"/>
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
</flow>
I don't know how can I read the input message in my java class( <component doc:name="Java"/>
). assume any class, I'm not yet implemented I don't know how to implement. Please any one help.
Thanks.
If you only have a single method in your class, it will be invoked automatically.
flow:
<set-payload value="world" doc:name="Set Payload"/>
<component doc:name="Java" class="my.test.Klass"/>
Java class:
package my.test;
public class Klass {
public String methhod (String s) {
return "hello "+s;
}
}
If you need something more complex you can define entry points, factories, etc.
http://www.mulesoft.org/documentation/display/current/Configuring+Java+Components
UPDATE:
For classes with multiple methods, you need to define an entry point resolver. The simplest approach is to use method name:
<component doc:name="Java" class="my.test.Klass">
<method-entry-point-resolver>
<include-entry-point method="methhod" />
</method-entry-point-resolver>
</component>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.