Hi Sanjay, Thanks for the quick response. Here's the code for the route:
public class DPUBFileProcessRoute extends RouteBuilder implements InitializingBean, DisposableBean { public static final long READ_LOCK_TIMEOUT = 10000; public static final String DPUB_PRF_SVC_CD = "DPUB"; public static final String DPUB_PRF_MVS_IND_ATTR_CD = "MVS_IND"; private static final String DIRECT_SEND_DATA_TO_MVS = "direct:send-data-to-mvs"; private static final String BEAN_EXCEPTION_HANDLER = "bean:exceptionHandler"; private static final int DEFAULT_MOM_EXTENSIONS_MAX_RETRIES = 3; private static final long DEFAULT_REDELIVER_DELAY = 10000L; private static final Logger LOGGER = LoggerFactory.getLogger(DPUBFileProcessRoute.class); public static final String LOCK_EXT = "camelLock"; private int momExcetionsMaxRetries = DEFAULT_MOM_EXTENSIONS_MAX_RETRIES; private long redeliverDelay = DEFAULT_REDELIVER_DELAY; private String dpubFileSource; private String dpubFileDestination; private String dpubMQName; private boolean enableMQ = true; // by default it is true private String camelFileName; private long camelReadLockTimeoutMs = READ_LOCK_TIMEOUT; private DPUBFileComponent component = null; private final Predicate isMqEnabled = new Predicate() { @Override public boolean matches(Exchange exchange) { return isEnableMQ(); } }; @Override public void configure() { Endpoint ep; component = new DPUBFileComponent(); component.setCamelContext(getContext()); onException(MessagingException.class) .maximumRedeliveries(getMomExcetionsMaxRetries()) .redeliverDelay(getRedeliverDelay()) .handled(false) .to(BEAN_EXCEPTION_HANDLER); onException(Throwable.class) .handled(false) .to(BEAN_EXCEPTION_HANDLER); final String string = "file:" + getDpubFileSource() + "?filter=#dpubFileFilter&move=" + getDpubFileDestination() + "&moveFailed=.err" + "&readLock=changed" + "&readLockTimeout=" + camelReadLockTimeoutMs; try { if (camelReadLockTimeoutMs > 0) { ep = component.createEndpoint(string); from(ep).process(new ExtractStationInfoProcessor()) .to(DIRECT_SEND_DATA_TO_MVS).to("bean:updateQueueProcessor"); } else { from(string).process(new ExtractStationInfoProcessor()) .to(DIRECT_SEND_DATA_TO_MVS).to("bean:updateQueueProcessor"); } from(DIRECT_SEND_DATA_TO_MVS) .split().method("dpubSplitterBean", "splitBody") .choice().when(isMqEnabled).to(getDpubMQName()); LOGGER.info(getClass().getCanonicalName() + " has been configured"); } catch (Exception e) { String errMsg = "Exception thrown creating Camel file route endpoint during DPUB-DC startup."; LOGGER.error(errMsg, e); dpubMetricsPublisher.publish(ErrorInfo.DPUB_SERVER_DC_PROCESSING_ERROR.createAlert(errMsg, Severity.CRITICAL)); } } . . . } Take care, - Doug On Tuesday, January 14, 2014 2:21 AM, Sanjay Bhattacharya <san...@gmail.com> wrote: Nothing seems to be wrong with the code. Can you show the route? Thanks, Sanjay On Tue, Jan 14, 2014 at 4:51 AM, Douglas Slattery <doug4...@yahoo.com> wrote: Hi, >I'm not sure if this is the correct place to post >this, but I stumbled on it looking for an answer to my problem... >I have a wierd situation with a Camel route file >component where the content was being read and now does not appear to be >so. >I've observed the situation from the following code >snippet > > > @Override > public void process(Exchange exchange) >{ > final String fileName = >exchange.getIn().getHeader("CamelFileNameOnly", String.class); > if (fileName != null) >{ > MDC.put("id", >fileName); > } > LOGGER.debug(">> {}", >getClass().getSimpleName()); > Map<String, Object> hdrMap = >exchange.getIn().getHeaders(); > Map<String, DataHandler> >atchMap = exchange.getIn().getAttachments(); > try { > Object manBody = >exchange.getIn().getMandatoryBody(); > Object manBodyAsStr = >exchange.getIn().getMandatoryBody(String.class); > } catch >(InvalidPayloadException e1) { > // TODO Auto-generated >catch block > e1.printStackTrace(); > } > > > final String fileContent = >exchange.getIn().getBody(String.class); > > > >Note that there are some extra lines of code I've >thrown in for troubleshooting. Also, fileName is filled and fileContent is >null. :S The file is a text file, so I don't get what's going >astray. >I've even tried: >final String fileContent = >exchange.getIn().getBody(byte[].class); > > >just to test if Camel might be picking up the file >as binary, but fileContent is still null. >I've been testing this on a Win7 machine & >haven't had the opportunity to try on a non-MS machine yet. >Hopefully, it is something simple (& expected) >that if you are using a Windows puke machine, just use the pepto api >:) >Thanks a bunch, >- Doug