Skip to content

Commit 53dd050

Browse files
authored
GH-3623: Deprecarte an IntegrationFlows
Fixes #3623 * `IntegrationFlow` refactoring * Apply several code style improvements and good practices * Code style: no empty lines for methods javadocs * make deprecated implementation reuse actual one instead of the copy-paste approach * add whats-new comments * Fix whats-new page according to standards
1 parent 63759d7 commit 53dd050

File tree

90 files changed

+796
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+796
-570
lines changed

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -59,7 +59,6 @@
5959
import org.springframework.integration.config.EnableIntegration;
6060
import org.springframework.integration.dsl.IntegrationFlow;
6161
import org.springframework.integration.dsl.IntegrationFlowBuilder;
62-
import org.springframework.integration.dsl.IntegrationFlows;
6362
import org.springframework.integration.dsl.Transformers;
6463
import org.springframework.integration.dsl.context.IntegrationFlowContext;
6564
import org.springframework.integration.support.MessageBuilder;
@@ -161,7 +160,7 @@ public void testAmqpOutboundFlow() {
161160

162161
@Test
163162
public void testTemplateChannelTransacted() {
164-
IntegrationFlowBuilder flow = IntegrationFlows.from(Amqp.channel("testTemplateChannelTransacted",
163+
IntegrationFlowBuilder flow = IntegrationFlow.from(Amqp.channel("testTemplateChannelTransacted",
165164
this.rabbitConnectionFactory)
166165
.autoStartup(false)
167166
.templateChannelTransacted(true));
@@ -235,7 +234,7 @@ void unitTestChannel() {
235234
@Test
236235
void testContentTypeOverrideWithReplyHeadersMappedLast() {
237236
IntegrationFlow testFlow =
238-
IntegrationFlows
237+
IntegrationFlow
239238
.from(Amqp.inboundGateway(this.rabbitConnectionFactory, this.amqpQueue2)
240239
.replyHeadersMappedLast(true))
241240
.transform(Transformers.fromJson())
@@ -300,7 +299,7 @@ public Queue defaultReplyTo() {
300299

301300
@Bean
302301
public IntegrationFlow amqpFlow(ConnectionFactory rabbitConnectionFactory, AmqpTemplate amqpTemplate) {
303-
return IntegrationFlows
302+
return IntegrationFlow
304303
.from(Amqp.inboundGateway(rabbitConnectionFactory, amqpTemplate, queue())
305304
.id("amqpInboundGateway")
306305
.configureContainer(c -> c
@@ -315,7 +314,7 @@ public IntegrationFlow amqpFlow(ConnectionFactory rabbitConnectionFactory, AmqpT
315314

316315
// syntax only
317316
public IntegrationFlow amqpDMLCFlow(ConnectionFactory rabbitConnectionFactory, AmqpTemplate amqpTemplate) {
318-
return IntegrationFlows
317+
return IntegrationFlow
319318
.from(Amqp.inboundGateway(new DirectMessageListenerContainer())
320319
.id("amqpInboundGateway")
321320
.configureContainer(c -> c
@@ -329,7 +328,7 @@ public IntegrationFlow amqpDMLCFlow(ConnectionFactory rabbitConnectionFactory, A
329328

330329
@Bean
331330
public IntegrationFlow amqpOutboundFlow(ConnectionFactory rabbitConnectionFactory, AmqpTemplate amqpTemplate) {
332-
return IntegrationFlows.from(Amqp.channel("amqpOutboundInput", rabbitConnectionFactory))
331+
return IntegrationFlow.from(Amqp.channel("amqpOutboundInput", rabbitConnectionFactory))
333332
.handle(Amqp.outboundAdapter(amqpTemplate).routingKeyExpression("headers.routingKey"))
334333
.get();
335334
}
@@ -346,7 +345,7 @@ public Queue amqpReplyChannel() {
346345

347346
@Bean
348347
public IntegrationFlow amqpInboundFlow(ConnectionFactory rabbitConnectionFactory) {
349-
return IntegrationFlows.from(Amqp.inboundAdapter(rabbitConnectionFactory, fooQueue())
348+
return IntegrationFlow.from(Amqp.inboundAdapter(rabbitConnectionFactory, fooQueue())
350349
.configureContainer(container -> container.consumerBatchEnabled(true)
351350
.batchSize(2))
352351
.batchMode(BatchMode.EXTRACT_PAYLOADS)
@@ -384,7 +383,7 @@ public Queue exDLQ() {
384383

385384
@Bean
386385
public IntegrationFlow inboundWithExceptionFlow(ConnectionFactory cf) {
387-
return IntegrationFlows.from(Amqp.inboundAdapter(cf, exQueue())
386+
return IntegrationFlow.from(Amqp.inboundAdapter(cf, exQueue())
388387
.configureContainer(c -> c.defaultRequeueRejected(false))
389388
.errorChannel("errors.input"))
390389
.handle(m -> {
@@ -421,7 +420,7 @@ public Queue exConvDLQ() {
421420

422421
@Bean
423422
public IntegrationFlow inboundWithConvExceptionFlow(ConnectionFactory cf) {
424-
return IntegrationFlows.from(Amqp.inboundAdapter(cf, exConvQueue())
423+
return IntegrationFlow.from(Amqp.inboundAdapter(cf, exConvQueue())
425424
.configureContainer(c -> c.defaultRequeueRejected(false))
426425
.messageConverter(new SimpleMessageConverter() {
427426

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/inbound/AmqpMessageSourceIntegrationTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,7 +54,6 @@
5454
import org.springframework.integration.config.EnableIntegration;
5555
import org.springframework.integration.core.MessageSource;
5656
import org.springframework.integration.dsl.IntegrationFlow;
57-
import org.springframework.integration.dsl.IntegrationFlows;
5857
import org.springframework.integration.dsl.Pollers;
5958
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
6059
import org.springframework.messaging.handler.annotation.Header;
@@ -198,7 +197,7 @@ public void ack(@Header(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK
198197

199198
@Bean
200199
public IntegrationFlow flow() {
201-
return IntegrationFlows.from(Amqp.inboundPolledAdapter(connectionFactory(), DSL_QUEUE),
200+
return IntegrationFlow.from(Amqp.inboundPolledAdapter(connectionFactory(), DSL_QUEUE),
202201
e -> e.poller(Pollers.fixedDelay(100)).autoStartup(false))
203202
.handle(p -> {
204203
this.fromDsl = p.getPayload();
@@ -209,7 +208,7 @@ public IntegrationFlow flow() {
209208

210209
@Bean
211210
public IntegrationFlow messageSourceChannelFlow() {
212-
return IntegrationFlows.from(interceptedSource(),
211+
return IntegrationFlow.from(interceptedSource(),
213212
e -> e.poller(Pollers.fixedDelay(100)).autoStartup(false))
214213
.handle(p -> {
215214
this.fromInterceptedSource = p.getPayload();

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/support/BoundRabbitChannelAdviceIntegrationTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,7 +41,6 @@
4141
import org.springframework.integration.amqp.dsl.Amqp;
4242
import org.springframework.integration.config.EnableIntegration;
4343
import org.springframework.integration.dsl.IntegrationFlow;
44-
import org.springframework.integration.dsl.IntegrationFlows;
4544
import org.springframework.integration.test.util.TestUtils;
4645
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4746

@@ -108,7 +107,7 @@ public BoundRabbitChannelAdvice advice(RabbitTemplate template) {
108107

109108
@Bean
110109
public IntegrationFlow flow(RabbitTemplate template, BoundRabbitChannelAdvice advice) {
111-
return IntegrationFlows.from(Gate.class)
110+
return IntegrationFlow.from(Gate.class)
112111
.split(s -> s.delimiters(",")
113112
.advice(advice))
114113
.<String, String>transform(String::toUpperCase)
@@ -118,7 +117,7 @@ public IntegrationFlow flow(RabbitTemplate template, BoundRabbitChannelAdvice ad
118117

119118
@Bean
120119
public IntegrationFlow listener(CachingConnectionFactory ccf) {
121-
return IntegrationFlows.from(Amqp.inboundAdapter(ccf, QUEUE))
120+
return IntegrationFlow.from(Amqp.inboundAdapter(ccf, QUEUE))
122121
.handle(m -> {
123122
received.add((String) m.getPayload());
124123
this.latch.countDown();

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/support/BoundRabbitChannelAdviceTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@
4343
import org.springframework.integration.amqp.dsl.Amqp;
4444
import org.springframework.integration.config.EnableIntegration;
4545
import org.springframework.integration.dsl.IntegrationFlow;
46-
import org.springframework.integration.dsl.IntegrationFlows;
4746
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4847

4948
import com.rabbitmq.client.Channel;
@@ -121,7 +120,7 @@ public RabbitTemplate template() throws Exception {
121120

122121
@Bean
123122
public IntegrationFlow flow(RabbitTemplate template) {
124-
return IntegrationFlows.from(Gate.class)
123+
return IntegrationFlow.from(Gate.class)
125124
.split(s -> s.delimiters(",")
126125
.advice(new BoundRabbitChannelAdvice(template, Duration.ofSeconds(10))))
127126
.<String, String>transform(String::toUpperCase)

spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ protected MessageChannel obtainInputChannelFromFlow(IntegrationFlow flow) {
426426
MessageChannel messageChannel = flow.getInputChannel();
427427
if (messageChannel == null) {
428428
messageChannel = new DirectChannel();
429-
IntegrationFlowDefinition<?> flowBuilder = IntegrationFlows.from(messageChannel);
429+
IntegrationFlowDefinition<?> flowBuilder = IntegrationFlow.from(messageChannel);
430430
flow.configure(flowBuilder);
431431
addComponent(flowBuilder.get());
432432
}
@@ -457,7 +457,7 @@ protected MessageChannel obtainInputChannelFromFlow(IntegrationFlow flow) {
457457
*/
458458
public B wireTap(String wireTapChannel, Consumer<WireTapSpec> wireTapConfigurer) {
459459
DirectChannel internalWireTapChannel = new DirectChannel();
460-
addComponent(IntegrationFlows.from(internalWireTapChannel).channel(wireTapChannel).get());
460+
addComponent(IntegrationFlow.from(internalWireTapChannel).channel(wireTapChannel).get());
461461
return wireTap(internalWireTapChannel, wireTapConfigurer);
462462
}
463463

spring-integration-core/src/main/java/org/springframework/integration/dsl/BroadcastPublishSubscribeSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 the original author or authors.
2+
* Copyright 2020-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ public BroadcastPublishSubscribeSpec subscribe(IntegrationFlow subFlow) {
5858
Assert.notNull(subFlow, "'subFlow' must not be null");
5959

6060
IntegrationFlowBuilder flowBuilder =
61-
IntegrationFlows.from(this.target)
61+
IntegrationFlow.from(this.target)
6262
.bridge(consumer -> consumer.order(this.order++));
6363

6464
MessageChannel subFlowInput = subFlow.getInputChannel();

spring-integration-core/src/main/java/org/springframework/integration/dsl/EndpointSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -163,7 +163,7 @@ protected MessageChannel obtainInputChannelFromFlow(IntegrationFlow subFlow, boo
163163
MessageChannel messageChannel = subFlow.getInputChannel();
164164
if (messageChannel == null) {
165165
messageChannel = new DirectChannel();
166-
IntegrationFlowDefinition<?> flowBuilder = IntegrationFlows.from(messageChannel);
166+
IntegrationFlowDefinition<?> flowBuilder = IntegrationFlow.from(messageChannel);
167167
subFlow.configure(flowBuilder);
168168
this.componentsToRegister.put(evaluateInternalBuilder ? flowBuilder.get() : flowBuilder, null);
169169
}

0 commit comments

Comments
 (0)