Skip to content

Commit d361eef

Browse files
artembilangaryrussell
authored andcommitted
Add missed options and JavaDocs to AMQP Java DSL
1 parent 09aeaac commit d361eef

File tree

7 files changed

+318
-19
lines changed

7 files changed

+318
-19
lines changed

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpBaseInboundChannelAdapterSpec.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2016 the original author or authors.
2+
* Copyright 2014-2018 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.
@@ -21,13 +21,16 @@
2121
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
2222
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
2323
import org.springframework.integration.dsl.MessageProducerSpec;
24+
import org.springframework.retry.RecoveryCallback;
25+
import org.springframework.retry.support.RetryTemplate;
2426

2527
/**
2628
* The base {@link MessageProducerSpec} implementation for a {@link AmqpInboundChannelAdapter}.
2729
*
2830
* @param <S> the target {@link AmqpBaseInboundChannelAdapterSpec} implementation type.
2931
*
3032
* @author Artem Bilan
33+
*
3134
* @since 5.0
3235
*/
3336
public class AmqpBaseInboundChannelAdapterSpec<S extends AmqpBaseInboundChannelAdapterSpec<S>>
@@ -74,4 +77,28 @@ public S mappedRequestHeaders(String... headers) {
7477
return _this();
7578
}
7679

80+
/**
81+
* Set a {@link RetryTemplate} to use for retrying a message delivery within the
82+
* adapter.
83+
* @param retryTemplate the template.
84+
* @return the spec.
85+
* @since 5.0.2
86+
* @see AmqpInboundChannelAdapter#setRetryTemplate(RetryTemplate)
87+
*/
88+
public S retryTemplate(RetryTemplate retryTemplate) {
89+
this.target.setRetryTemplate(retryTemplate);
90+
return _this();
91+
}
92+
93+
/**
94+
* Set a {@link RecoveryCallback} when using retry within the adapter.
95+
* @param recoveryCallback the callback.
96+
* @since 5.0.2
97+
* @see AmqpInboundChannelAdapter#setRecoveryCallback(RecoveryCallback)
98+
*/
99+
public S recoveryCallback(RecoveryCallback<?> recoveryCallback) {
100+
this.target.setRecoveryCallback(recoveryCallback);
101+
return _this();
102+
}
103+
77104
}

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpBaseInboundGatewaySpec.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2016 the original author or authors.
2+
* Copyright 2014-2018 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.
@@ -21,6 +21,8 @@
2121
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
2222
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
2323
import org.springframework.integration.dsl.MessagingGatewaySpec;
24+
import org.springframework.retry.RecoveryCallback;
25+
import org.springframework.retry.support.RetryTemplate;
2426

2527
/**
2628
* A base {@link MessagingGatewaySpec} implementation for {@link AmqpInboundGateway} endpoint options.
@@ -29,6 +31,7 @@
2931
* @param <S> the target {@link AmqpBaseInboundGatewaySpec} implementation type.
3032
*
3133
* @author Artem Bilan
34+
*
3235
* @since 5.0
3336
*
3437
* @see AmqpInboundGateway
@@ -60,6 +63,7 @@ public S messageConverter(MessageConverter messageConverter) {
6063
* {@link org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper}.
6164
* @param headerMapper the headerMapper.
6265
* @return the spec.
66+
* @see AmqpInboundGateway#setHeaderMapper(AmqpHeaderMapper)
6367
*/
6468
public S headerMapper(AmqpHeaderMapper headerMapper) {
6569
this.target.setHeaderMapper(headerMapper);
@@ -70,7 +74,7 @@ public S headerMapper(AmqpHeaderMapper headerMapper) {
7074
* Only applies if the default header mapper is used.
7175
* @param headers the headers.
7276
* @return the spec.
73-
* @see org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper#setRequestHeaderNames(String[])
77+
* @see DefaultAmqpHeaderMapper#setRequestHeaderNames(String[])
7478
*/
7579
public S mappedRequestHeaders(String... headers) {
7680
this.headerMapper.setRequestHeaderNames(headers);
@@ -81,7 +85,7 @@ public S mappedRequestHeaders(String... headers) {
8185
* Only applies if the default header mapper is used.
8286
* @param headers the headers.
8387
* @return the spec.
84-
* @see org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper#setReplyHeaderNames(String[])
88+
* @see DefaultAmqpHeaderMapper#setReplyHeaderNames(String[])
8589
*/
8690
public S mappedReplyHeaders(String... headers) {
8791
this.headerMapper.setReplyHeaderNames(headers);
@@ -109,4 +113,28 @@ public S defaultReplyTo(String defaultReplyTo) {
109113
return _this();
110114
}
111115

116+
/**
117+
* Set a {@link RetryTemplate} to use for retrying a message delivery within the
118+
* adapter.
119+
* @param retryTemplate the template.
120+
* @return the spec.
121+
* @since 5.0.2
122+
* @see AmqpInboundGateway#setRetryTemplate(RetryTemplate)
123+
*/
124+
public S retryTemplate(RetryTemplate retryTemplate) {
125+
this.target.setRetryTemplate(retryTemplate);
126+
return _this();
127+
}
128+
129+
/**
130+
* Set a {@link RecoveryCallback} when using retry within the adapter.
131+
* @param recoveryCallback the callback.
132+
* @since 5.0.2
133+
* @see AmqpInboundGateway#setRecoveryCallback(RecoveryCallback)
134+
*/
135+
public S recoveryCallback(RecoveryCallback<?> recoveryCallback) {
136+
this.target.setRecoveryCallback(recoveryCallback);
137+
return _this();
138+
}
139+
112140
}

0 commit comments

Comments
 (0)