...
Code Block |
---|
lang | xml |
---|
title | Custom marshaler |
---|
|
<quartz:endpoint service="test:service" endpoint="endpoint3" targetService="test:receiver3">
<quartz:jobDetail>
<quartz:jobDetail>
<quartz:jobDataAsMap>
<quartz:property key="xml"><![CDATA[
<hello>world</hello>
]]></quartz:property>
</quartz:jobDataAsMap>
</quartz:jobDetail>
</quartz:jobDetail>
<quartz:triggers>
<quartz:simple repeatCount="0" repeatInterval="1000" />
<quartz:cron cronExpression="0 * 1 * * ?" />
</quartz:triggers>
<quartz:marshaler>
<bean class="org.apache.servicemix.quartz.CustomMarshaler" />
</quartz:marshaler>
</quartz:endpoint>
|
The snippet above requires a CustomMarshaler implementation that can get the information from the job data map and add it to the NormalizedMessage.
Code Block |
---|
lang | java |
---|
title | Custom marshaler class |
---|
|
public class CustomMarshaler extends DefaultQuartzMarshaler {
public void populateNormalizedMessage(NormalizedMessage message, JobExecutionContext context)
throws JobExecutionException, MessagingException {
super.populateNormalizedMessage(message, context);
//add your own content to the message here
message.setContent(new StringSource((String) context.getJobDetail().getJobDataMap().get("xml")));
}
}
|