@Bean public IntegrationFlow outboundFlow(ActiveMQConnectionFactory connectionFactory) { return IntegrationFlows .from(requests()) .handle(Jms.outboundAdapter(connectionFactory).destination("requests")) .get(); }
@Bean public IntegrationFlow outboundFlow(ActiveMQConnectionFactory connectionFactory) { return IntegrationFlows .from(requests()) .handle(Jms.outboundAdapter(connectionFactory).destination("requests")) .get(); }
@Bean public IntegrationFlow outboundFlow(ActiveMQConnectionFactory connectionFactory) { return IntegrationFlows .from(replies()) .handle(Jms.outboundAdapter(connectionFactory).destination("replies")) .get(); }
@Bean public IntegrationFlow outboundFlow(ActiveMQConnectionFactory connectionFactory) { return IntegrationFlows .from(replies()) .handle(Jms.outboundAdapter(connectionFactory).destination("replies")) .get(); }
@Bean public IntegrationFlow outboundFlow(ActiveMQConnectionFactory connectionFactory) { return IntegrationFlows .from(requests()) .handle(Jms.outboundAdapter(connectionFactory).destination("requests")) .get(); }
/** * Create an {@link IntegrationFlow} with a {@link ChunkProcessorChunkHandler} * configured as a service activator listening to the input channel and replying * on the output channel. * * @return the integration flow */ @SuppressWarnings({"unchecked", "rawtypes"}) public IntegrationFlow build() { Assert.notNull(this.itemWriter, "An ItemWriter must be provided"); Assert.notNull(this.inputChannel, "An InputChannel must be provided"); Assert.notNull(this.outputChannel, "An OutputChannel must be provided"); if(this.itemProcessor == null) { this.itemProcessor = new PassThroughItemProcessor(); } SimpleChunkProcessor<I, O> chunkProcessor = new SimpleChunkProcessor<>(this.itemProcessor, this.itemWriter); ChunkProcessorChunkHandler<I> chunkProcessorChunkHandler = new ChunkProcessorChunkHandler<>(); chunkProcessorChunkHandler.setChunkProcessor(chunkProcessor); return IntegrationFlows .from(this.inputChannel) .handle(chunkProcessorChunkHandler, SERVICE_ACTIVATOR_METHOD_NAME) .channel(this.outputChannel) .get(); }
.handle(stepExecutionRequestHandler, SERVICE_ACTIVATOR_METHOD_NAME) .channel(this.outputChannel) .get();
@Bean public IntegrationFlow methodInvokingFlow() { return IntegrationFlows.from("methodInvokingInput") .handle(this.greetingService) .get(); }
@Bean public IntegrationFlow listener(CachingConnectionFactory ccf) { return IntegrationFlows.from(Amqp.inboundAdapter(ccf, QUEUE)) .handle(m -> { received.add((String) m.getPayload()); this.latch.countDown(); }) .get(); }
@Bean public IntegrationFlow serviceFlow() { return IntegrationFlows.from(ServiceGateway.class) .channel("serviceChannel") .handle(this) .get(); }
@Bean public IntegrationFlow errorRecovererFlow() { return IntegrationFlows.from(Function.class, "errorRecovererFunction") .handle((GenericHandler<?>) (p, h) -> { throw new RuntimeException("intentional"); }, e -> e.advice(retryAdvice())) .get(); }
@Bean public IntegrationFlow wireTapFlow1() { return IntegrationFlows.from("tappedChannel1") .wireTap("tapChannel", wt -> wt.selector(m -> m.getPayload().equals("foo"))) .handle(loggingMessageHandler()) .get(); }
@Bean public IntegrationFlow messageSourceChannelFlow() { return IntegrationFlows.from(interceptedSource(), e -> e.poller(Pollers.fixedDelay(100)).autoStartup(false)) .handle(p -> { this.fromInterceptedSource = p.getPayload(); this.latch.countDown(); }) .get(); }
@Bean public IntegrationFlow amqpOutboundFlow(ConnectionFactory rabbitConnectionFactory, AmqpTemplate amqpTemplate) { return IntegrationFlows.from(Amqp.channel("amqpOutboundInput", rabbitConnectionFactory)) .handle(Amqp.outboundAdapter(amqpTemplate).routingKeyExpression("headers.routingKey")) .get(); }
@Bean public IntegrationFlow inboundWithExceptionFlow(ConnectionFactory cf) { return IntegrationFlows.from(Amqp.inboundAdapter(cf, exQueue()) .configureContainer(c -> c.defaultRequeueRejected(false)) .errorChannel("errors.input")) .handle(m -> { throw new RuntimeException("fail"); }) .get(); }
@Bean public IntegrationFlow sseFlow() { return IntegrationFlows .from(WebFlux.inboundGateway("/sse") .requestMapping(m -> m.produces(MediaType.TEXT_EVENT_STREAM_VALUE)) .mappedResponseHeaders("*")) .enrichHeaders(Collections.singletonMap("aHeader", new String[] { "foo", "bar", "baz" })) .handle((p, h) -> Flux.fromArray(h.get("aHeader", String[].class))) .get(); }
@Bean public IntegrationFlow fileWritingFlow() { return IntegrationFlows.from("fileWritingInput") .enrichHeaders(h -> h.header(FileHeaders.FILENAME, "foo.write") .header("directory", new File(tmpDir.getRoot(), "fileWritingFlow"))) .handle(Files.outboundGateway(m -> m.getHeaders().get("directory")) .preserveTimestamp(true) .chmod(0777)) .channel(MessageChannels.queue("fileWritingResultChannel")) .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 httpProxyFlow() { return IntegrationFlows .from(httpService()) .handle(Http.outboundGateway("/service/internal?{params}") .uriVariable("params", "payload") .expectedResponseType(String.class) .errorHandler(new HttpProxyResponseErrorHandler()), e -> e.id("serviceInternalGateway")) .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(); }