public static AggregateDefinition completionPredicate(AggregateDefinition self, Closure<?> predicate) { return self.completionPredicate(toExpression(predicate)); }
@Override public void configure() throws Exception { logger.info("Configure Recurrent Route 'Export :: Data Producer'"); RouteDefinition rtDef; if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) { rtDef = from((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_TO, RouterConstants.DIRECT_EXPORT_DEPOSIT_BUFFER)); } else { rtDef = from((String) getEndpointURI(RouterConstants.DIRECTION_TO, RouterConstants.DIRECT_EXPORT_DEPOSIT_BUFFER)); } LineBuildProcessor processor = new LineBuildProcessor(profileExportService); rtDef.unmarshal(jacksonDataFormat) .process(processor) .aggregate(constant(true), new StringLinesAggregationStrategy()) .completionPredicate(exchangeProperty("CamelSplitSize").isEqualTo(exchangeProperty("CamelAggregatedSize"))) .eagerCheckCompletion() .process(exportRouteCompletionProcessor) .toD("${in.header.exportConfig.getProperty('destination')}"); }
@Override public void configure() throws Exception { logger.info("Configure Recurrent Route 'To Target'"); RouteDefinition rtDef; if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) { rtDef = from((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_TO, RouterConstants.DIRECT_IMPORT_DEPOSIT_BUFFER)); } else { rtDef = from((String) getEndpointURI(RouterConstants.DIRECTION_TO, RouterConstants.DIRECT_IMPORT_DEPOSIT_BUFFER)); } rtDef.choice() .when(header(RouterConstants.HEADER_FAILED_MESSAGE).isNull()) .unmarshal(jacksonDataFormat) .process(unomiStorageProcessor) .otherwise() .log(LoggingLevel.DEBUG, "Failed message, skip processing!") .end() .aggregate(constant(true), new ArrayListAggregationStrategy()) .completionPredicate(exchangeProperty("CamelSplitComplete").isEqualTo("true")) .eagerCheckCompletion() .process(importRouteCompletionProcessor) .to("log:org.apache.unomi.router?level=DEBUG"); }