/** * Configure a subflow to run for discarded messages instead of a * {@link #discardChannel(MessageChannel)}. * @param discardFlow the discard flow. * @return the endpoint spec. */ public FilterEndpointSpec discardFlow(IntegrationFlow discardFlow) { return discardChannel(obtainInputChannelFromFlow(discardFlow)); }
@Bean public IntegrationFlow scriptFilter() { return f -> f.filter(Scripts.processor(this.filterScript), e -> e.discardChannel("discardChannel")) .channel(results()); }
@Bean public IntegrationFlow scriptFilter() { return f -> f .filter(Scripts.processor(scriptResource()) .lang("groovy"), e -> e.discardChannel("discardChannel")) .channel(c -> c.queue("results")); }
/** * Configure a subflow to run for discarded messages instead of a * {@link #discardChannel(MessageChannel)}. * @param discardFlow the discard flow. * @return the endpoint spec. */ public FilterEndpointSpec discardFlow(IntegrationFlow discardFlow) { return discardChannel(obtainInputChannelFromFlow(discardFlow)); }
/** * Configure a subflow to run for discarded messages instead of a * {@link #discardChannel(MessageChannel)}. * @param discardFlow the discard flow. * @return the endpoint spec. */ public FilterEndpointSpec discardFlow(IntegrationFlow discardFlow) { Assert.notNull(discardFlow, "'discardFlow' must not be null"); DirectChannel channel = new DirectChannel(); IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel); discardFlow.configure(flowBuilder); this.componentToRegister.add(flowBuilder.get()); return discardChannel(channel); }
/** * Configure a subflow to run for discarded messages instead of a * {@link #discardChannel(MessageChannel)}. * @param discardFlow the discard flow. * @return the endpoint spec. */ public FilterEndpointSpec discardFlow(IntegrationFlow discardFlow) { Assert.notNull(discardFlow, "'discardFlow' must not be null"); DirectChannel channel = new DirectChannel(); IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel); discardFlow.configure(flowBuilder); this.componentToRegister.add(flowBuilder.get()); return discardChannel(channel); }
@Bean public IntegrationFlow scriptFilter() { return f -> f.filter(Scripts.script(this.filterScript), e -> e.discardChannel("discardChannel")) .channel(results()); }
@Bean public IntegrationFlow xpathFlow(MessageChannel wrongMessagesChannel) { return IntegrationFlows.from("inputChannel") .filter(new StringValueTestXPathMessageSelector("namespace-uri(/*)", "my:namespace"), e -> e.discardChannel(wrongMessagesChannel)) .log(LoggingHandler.Level.ERROR, "test.category", m -> m.getHeaders().getId()) .route(xpathRouter(wrongMessagesChannel)) .get(); }
@Bean public IntegrationFlow fileSplitterAggregator() { return IntegrationFlows .from(Files.inboundAdapter(new File("/tmp/in")) .autoCreateDirectory(true) .patternFilter("*.txt"), e -> e.poller(Pollers.fixedDelay(5000))) .split(Files.splitter() .markers() .applySequence(true)) .filter(p -> !(p instanceof FileSplitter.FileMarker), e -> e.discardChannel("aggregatorChannel")) .<String, Name>transform(Name::new) .<Name>filter(p -> !p.getValue().startsWith("X")) .channel("aggregatorChannel") .aggregate(a -> a.processor(new FileMarkerAggregator())) .<List<Name>, Names>transform(Names::new) .transform(Transformers.marshaller(jaxbMarshaller(), new ResultToStringTransformer())) .handle(Files.outboundAdapter("'/tmp/out'") .fileNameGenerator(m -> m .getHeaders() .get(FileHeaders.FILENAME, String.class) .replace(".txt", ".xml")) .autoCreateDirectory(true)) .get(); }