FileBinding custom message composer
hamid1982 Jan 17, 2013 6:41 AMHi,
I try to define my own message composer for a FileBinding component. My switchyard configuration :
<?xml version="1.0" encoding="UTF-8"?>
<switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:file="urn:switchyard-component-camel-file:config:1.0" xmlns:jms="urn:switchyard-component-camel-jms:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="PATT_SWYARD_ESB" targetNamespace="urn:com.patt.switchyard:PATT_SWYARD_ESB:1.0">
<sca:composite name="PATT_SWYARD_ESB" targetNamespace="urn:com.patt.switchyard:PATT_SWYARD_ESB:1.0">
<sca:service name="FileBinding" promote="Component/FileBinding">
<sca:interface.java interface="com.patt.switchyard.pattesb.FileBinding"/>
<file:binding.file>
<file:contextMapper class="com.patt.switchyard.pattesb.FileBindingContextMapper"/>
<file:messageComposer class="com.patt.switchyard.pattesb.FileBindingMessageComposer"/>
<file:directory>C:/datas_prod/queues/in</file:directory>
<file:consume>
<file:initialDelay>50</file:initialDelay>
<file:delay>50</file:delay>
<file:recursive>true</file:recursive>
<file:move>C:/datas_prod/queues/working/${file:onlyname.noext}.esbWorking</file:move>
<file:moveFailed>C:/datas_prod/queues/error</file:moveFailed>
<file:include>(.)*(_in_)(.)*\.(xml\.ok)</file:include>
</file:consume>
</file:binding.file>
</sca:service>
<sca:component name="Component">
<bean:implementation.bean class="com.patt.switchyard.pattesb.FileBindingBean"/>
<sca:service name="FileBinding">
<sca:interface.java interface="com.patt.switchyard.pattesb.FileBinding"/>
</sca:service>
</sca:component>
</sca:composite>
</switchyard>
My Custom Class Message Composer is defined below :
public class FileBindingMessageComposer implements MessageComposer<CamelBindingData> {
@Override
public ContextMapper<CamelBindingData> getContextMapper() {
// some code source
return ....;
}
@Override
public MessageComposer<CamelBindingData> setContextMapper(
ContextMapper<CamelBindingData> contextMapper) {
// some code source
return ....;
}
@Override
public Message compose(CamelBindingData source, Exchange exchange,
boolean create) throws Exception {
// some code source
return ....;
}
@Override
public CamelBindingData decompose(Exchange exchange, CamelBindingData target)
throws Exception {
// some code source
return ....;
}
I defined also a context mapper class :
public class FileBindingContextMapper implements ContextMapper<CamelBindingData> {
@Override
public void mapFrom(CamelBindingData source, Context context)
throws Exception {
// some code source
}
@Override
public void mapTo(Context context, CamelBindingData target)
throws Exception {
// some code source
}
}
When i put the file in the source directory to be pulled from. No message composer is invoked (both method compose and decompose).
Is there anything missing on my configuration ?