@Bean public IntegrationFlow enrichFlow() { return IntegrationFlows.from("enrichChannel") .<TestPojo, Map<?, ?>>transform(p -> { if ("junk".equals(p.getName())) { throw new RuntimeException("intentional"); } return Collections.singletonMap("name", p.getName() + " Bar"); }) .get(); }
@Bean public IntegrationFlow subFlow() { return IntegrationFlows .from("processChannel") .<String, String>transform(String::toUpperCase) .channel("replyChannel") .get(); }
@Bean public IntegrationFlow lambdasFlow() { return IntegrationFlows.from("lambdasInput") .filter(String.class, "World"::equals) .transform(String.class, "Hello "::concat) .get(); }
@Bean public IntegrationFlow recoveryFlow() { return IntegrationFlows.from(recoveryChannel()) .<MessagingException, Message<?>>transform(MessagingException::getFailedMessage) .get(); }
@Bean public IntegrationFlow gatewayRequestFlow() { return IntegrationFlows.from("gatewayRequest") .filter("foo"::equals, f -> f.throwExceptionOnRejection(true)) .<String, String>transform(String::toUpperCase) .get(); }
@Bean public IntegrationFlow supplierFlow() { return IntegrationFlows.from(stringSupplier()) .transform(toUpperCaseFunction()) .channel("suppliedChannel") .get(); }
@Bean public IntegrationFlow httpInternalServiceFlow() { return IntegrationFlows .from(Http.inboundGateway("/service/internal") .requestMapping(r -> r.params("name")) .payloadExpression("#requestParams.name")) .channel(transformSecuredChannel()) .<List<String>, String>transform(p -> p.get(0).toUpperCase()) .get(); }
@Bean public IntegrationFlow myFlow() { return IntegrationFlows .from(() -> new GenericMessage<>("myData"), e -> e.id("mySourceEndpoint")) .<String, String>transform(String::toUpperCase) .channel(results()) .get(); }
@Bean public IntegrationFlow jmsInboundFlow() { return IntegrationFlows .from(Jms.inboundAdapter(jmsConnectionFactory()).destination("jmsInbound")) .<String, String>transform(String::toUpperCase) .channel(this.jmsOutboundInboundReplyChannel()) .get(); }
@Bean public Publisher<Message<Integer>> pollableReactiveFlow() { return IntegrationFlows .from("inputChannel") .split(s -> s.delimiters(",")) .<String, Integer>transform(Integer::parseInt) .channel(MessageChannels.queue()) .log() .toReactivePublisher(); }
@Bean public IntegrationFlow jmsInboundGatewayFlow() { return IntegrationFlows.from( Jms.inboundGateway(jmsConnectionFactory()) .requestChannel(jmsInboundGatewayInputChannel()) .destination("jmsPipelineTest") .configureListenerContainer(c -> c.transactionManager(mock(PlatformTransactionManager.class)))) .<String, String>transform(String::toUpperCase) .get(); }
@Bean public IntegrationFlow flow(RabbitTemplate template) { return IntegrationFlows.from(Gate.class) .split(s -> s.delimiters(",") .advice(new BoundRabbitChannelAdvice(template, Duration.ofSeconds(10)))) .<String, String>transform(String::toUpperCase) .handle(Amqp.outboundAdapter(template).routingKey("rk")) .get(); }
@Bean public IntegrationFlow jmsMessageDrivenFlowWithContainer() { return IntegrationFlows .from(Jms.messageDrivenChannelAdapter( Jms.container(jmsConnectionFactory(), "containerSpecDestination") .pubSubDomain(false) .taskExecutor(Executors.newCachedThreadPool()) .get())) .transform(String::trim) .channel(jmsOutboundInboundReplyChannel()) .get(); }
@Bean public IntegrationFlow flow(RabbitTemplate template, BoundRabbitChannelAdvice advice) { return IntegrationFlows.from(Gate.class) .split(s -> s.delimiters(",") .advice(advice)) .<String, String>transform(String::toUpperCase) .handle(Amqp.outboundAdapter(template).routingKey(QUEUE)) .get(); }
@Bean public IntegrationFlow tailFlow() { return IntegrationFlows .from(Files.tailAdapter(new File(tmpDir.getRoot(), "TailTest")) .delay(500) .end(false) .id("tailer") .autoStartup(false)) .transform("hello "::concat) .channel(MessageChannels.queue("tailChannel")) .get(); }
public IntegrationFlow amqpDMLCFlow(ConnectionFactory rabbitConnectionFactory, AmqpTemplate amqpTemplate) { return IntegrationFlows .from(Amqp.inboundGateway(new DirectMessageListenerContainer()) .id("amqpInboundGateway") .configureContainer(c -> c .recoveryInterval(5000) .consumersPerQueue(1)) .defaultReplyTo(defaultReplyTo().getName())) .transform("hello "::concat) .transform(String.class, String::toUpperCase) .get(); }
@Bean public IntegrationFlow amqpInboundFlow(ConnectionFactory rabbitConnectionFactory) { return IntegrationFlows.from(Amqp.inboundAdapter(rabbitConnectionFactory, fooQueue()) .id("amqpInboundFlowAdapter")) .transform(String.class, String::toUpperCase) .channel(Amqp.pollableChannel(rabbitConnectionFactory) .queueName("amqpReplyChannel") .channelTransacted(true)) .get(); }
@Bean public IntegrationFlow jmsMessageDrivenFlow() { return IntegrationFlows .from(Jms.messageDrivenChannelAdapter(jmsConnectionFactory(), DefaultMessageListenerContainer.class) .outputChannel(jmsMessageDrivenInputChannel()) .destination("jmsMessageDriven") .configureListenerContainer(c -> c.clientId("foo"))) .<String, String>transform(String::toLowerCase) .channel(jmsOutboundInboundReplyChannel()) .get(); }
@Override protected IntegrationFlowDefinition<?> buildFlow() { return from(this, "messageSource", e -> e.poller(p -> p.trigger(this::nextExecutionTime))) .split(this, null, e -> e.applySequence(false)) .transform(this) .aggregate(a -> a.processor(this, null)) .enrichHeaders(Collections.singletonMap("foo", "FOO")) .filter(this) .handle(this) .channel(MessageChannels.queue("myFlowAdapterOutput")) .log(); }