Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
langxml
titleCustom 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
langjava
titleCustom 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"))); 
    }
}