I am trying to copy files and change their contents based on an incoming JMS
message. If the same file name is passed in more then once the consumer
only picks up the file on the first message. I have tried putting
"&idempotent=false" on the url but it made no difference.
from("activemq:queue:crossBoundaryCouncils").process(new Processor() {
public void process(final Exchange exchange) throws Exception {
// Get Header properties
Message message = (Message) exchange.getIn();
final String filename = (String) message.getHeader("filename");
final String councilAuthorityCode = (String)
exchange.getIn().getHeader("councilAuthorityCode");
final String childAuthorityCode = (String)
exchange.getIn().getHeader("childAuthorityCode");
String url = getFileRepository().getEndpointUri() +
"?readLock=none&fileName=" + filename;
Endpoint endpoint = getContext().getEndpoint(url);
PollingConsumer consumer = endpoint.createPollingConsumer();
consumer.start();
Exchange pollExchange = consumer.receive();
consumer.stop();
String body = pollExchange.getIn().getBody(String.class);
String childFilename = filename;
childFilename = StringUtils.replace(childFilename, councilAuthorityCode,
childAuthorityCode);
String childBody = StringUtils.replace(body, councilAuthorityCode,
childAuthorityCode);
exchange.getOut().setHeader("parentFilename",filename);
exchange.getOut().setHeader("childAuthorityCode",childAuthorityCode);
exchange.getOut().setHeader(Exchange.FILE_NAME,childFilename);
exchange.getOut().setBody(childBody);
}
}).to(file://C://fileserver);
Camel version 2.1.0
WIndows XP
--
View this message in context:
http://old.nabble.com/Files-ignored-on-second-scan-of-directory-tp27547556p27547556.html
Sent from the Camel - Users mailing list archive at Nabble.com.