camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kraythe ." <>
Subject File aggregation and transaction.
Date Fri, 06 Dec 2013 01:36:21 GMT
I have a route that I will past below. The route is transacted and I want
it to read off a queue and then batch the records into a file. However, if
someone murders the server with kill -9 prior to the file being written, I
would like all of those records to end up back in the queue to be processed
next time the server goes up. That is not the behavior we are seeing. If we
kill the server any records in transit are gobbled and dropped and the file
not written. What are we doing wrong? Note this is a method that generates
routes for us when we call it. Thanks a bunch:

  protected void publishExcelFileForRecordQueue(final String queue,
finalString routeID,
final String path,

      final long batchcompletionTimeout, final Comparator<Record> sorter,
final MappedExcelDataFormat medf, final String fileNameExpr) {

    from(endpointAMQ(queue)) // Consume routed cases

        .routeId(routeID) // Route Id for this route.

// catch exceptions

        .setHeader(Exchange.FAILURE_ROUTE_ID, property(Exchange.
FAILURE_ROUTE_ID)) // set route that errored

        .setHeader(Exchange.EXCEPTION_CAUGHT, simple(
"${exception.stacktrace}")) // Store reason for error

// to DLQ

        .transacted(KEY_TXPOLICY_REQUIRED) // make the route transacted

        .unmarshal(new JacksonDataFormat(this.jacksonMapper, Record.class)) //
unmarshal from JSON

        .aggregate(constant(true), newRecordListAggregationStrategy(sorter)) //
Aggregate and sort records.

        .completionTimeout(batchcompletionTimeout) // Make as single report

        .marshal(medf) // Write the agregated exchanges to excel

        .to("file:" + path + "?fileName=" + fileNameExpr +
"&tempPrefix=.medf.").id("file_writer") // write the data to the file.




*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message