Skip to content

Commit 6bff6b9

Browse files
committed
Doc Polishing.
1 parent 8a45e85 commit 6bff6b9

File tree

8 files changed

+54
-45
lines changed

8 files changed

+54
-45
lines changed

spring-integration-core/src/main/java/org/springframework/integration/annotation/IdempotentReceiver.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
import java.lang.annotation.Target;
2424

2525
/**
26-
* Indicate a method with the MessagingAnnotation (@code @ServiceActivator, @Router etc.)
27-
* to apply for the underlying {@link org.springframework.messaging.MessageHandler#handleMessage}
28-
* the {@link org.springframework.integration.handler.advice.IdempotentReceiverInterceptor} using
29-
* its id from the {@link #value()}.
26+
* A {@code @Bean} that has a MessagingAnnotation (@code @ServiceActivator, @Router etc.)
27+
* that also has this annotation, has an
28+
* {@link org.springframework.integration.handler.advice.IdempotentReceiverInterceptor} applied
29+
* to the associated {@link org.springframework.messaging.MessageHandler#handleMessage} method.
30+
* The interceptor bean names are provided in the {@link #value()}.
3031
*
3132
* @author Artem Bilan
3233
* @since 4.1

spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import org.springframework.util.PatternMatchUtils;
3434

3535
/**
36-
* The {@link AbstractAutoProxyCreator} implementation to apply {@code IdempotentReceiverInterceptor}s
37-
* to the {@link MessageHandler}s mapped by their {@code endpoint beanName}.
36+
* The {@link AbstractAutoProxyCreator} implementation that applies {@code IdempotentReceiverInterceptor}s
37+
* to {@link MessageHandler}s mapped by their {@code endpoint beanName}.
3838
*
3939
* @author Artem Bilan
4040
* @since 4.1

spring-integration-core/src/main/java/org/springframework/integration/config/IdempotentReceiverAutoProxyCreatorInitializer.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
import org.springframework.util.StringUtils;
3535

3636
/**
37-
* The {@link IntegrationConfigurationInitializer} to populate {@link IdempotentReceiverAutoProxyCreator}
38-
* to the provided {@link ConfigurableListableBeanFactory} according to the existing
39-
* {@code IdempotentReceiverInterceptor} {@link BeanDefinition}s and their {@code mapping}
40-
* to the Consumer Endpoints.
37+
* The {@link IntegrationConfigurationInitializer} that populates
38+
* the {@link ConfigurableListableBeanFactory}
39+
* with an {@link IdempotentReceiverAutoProxyCreator}
40+
* when {@code IdempotentReceiverInterceptor} {@link BeanDefinition}s and their {@code mapping}
41+
* to Consumer Endpoints are present.
4142
*
4243
* @author Artem Bilan
4344
* @since 4.1
@@ -77,10 +78,10 @@ else if (beanDefinition instanceof AnnotatedBeanDefinition) {
7778
Object value = beanMethod.getAnnotationAttributes(annotationType).get("value");
7879
if (value != null) {
7980
String[] interceptors = (String[]) value;
80-
/* MessageHandler beans, populated from the @Bean methods, have the complex id,
81-
including @Configuration bean name, method name and Messaging annotation name.
82-
Therefore we should provide here some pattern closer to the real MessageHandler
83-
bean name.
81+
/*
82+
MessageHandler beans, populated from @Bean methods, have a complex id,
83+
including @Configuration bean name, method name and the Messaging annotation name.
84+
The following pattern matches the bean name, regardless of the annotation name.
8485
*/
8586
String endpoint = beanDefinition.getFactoryBeanName() + "." + beanName + ".*";
8687
for (String interceptor : interceptors) {

spring-integration-core/src/main/java/org/springframework/integration/handler/advice/IdempotentReceiverInterceptor.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141
/**
4242
* The {@link MethodInterceptor} implementation for the
4343
* <a href="http://www.eaipatterns.com/IdempotentReceiver.html">Idempotent Receiver</a>
44-
* EIP pattern.
44+
* E.I. Pattern.
4545
* <p>
46-
* This {@link MethodInterceptor} works like {@code MessageFilter} if {@link #discardChannel}
46+
* This {@link MethodInterceptor} works like a {@code MessageFilter} if {@link #discardChannel}
4747
* is provided or {@link #throwExceptionOnRejection} is set to {@code true}.
4848
* However if those properties aren't provided, this interceptor will create an new {@link Message}
49-
* with {@link IntegrationMessageHeaderAccessor#DUPLICATE_MESSAGE} header in case of the
49+
* with a {@link IntegrationMessageHeaderAccessor#DUPLICATE_MESSAGE} header when the
5050
* {@code requestMessage} isn't accepted by {@link MessageSelector}.
5151
* <p>
5252
* The {@code idempotent filtering} logic depends on the provided {@link MessageSelector}.
5353
* <p>
54-
* This class is designed to be used just only for the {@link MessageHandler#handleMessage},
55-
* as well as the entire {@code Idempotent Receiver} pattern.
54+
* This class is designed to be used only for the {@link MessageHandler#handleMessage},
55+
* method.
5656
*
5757
* @author Artem Bilan
5858
* @since 4.1
@@ -79,7 +79,7 @@ public IdempotentReceiverInterceptor(MessageSelector messageSelector) {
7979
}
8080

8181
/**
82-
* Specify the timeout value for sending to the intercepting target.
82+
* Specify the timeout value for sending to the discard channel.
8383
* @param timeout the timeout in milliseconds
8484
*/
8585
public void setTimeout(long timeout) {
@@ -90,12 +90,13 @@ public void setTimeout(long timeout) {
9090
* Specify whether this interceptor should throw a
9191
* {@link MessageRejectedException} when its selector does not accept a
9292
* Message. The default value is <code>false</code> meaning that rejected
93-
* Messages will be enriched with {@link IntegrationMessageHeaderAccessor#DUPLICATE_MESSAGE}
93+
* Messages will be discarded or
94+
* enriched with {@link IntegrationMessageHeaderAccessor#DUPLICATE_MESSAGE}
9495
* header and returned as normal to the {@code invocation.proceed()}.
95-
* Typically this value would not be <code>true</code> when
96-
* a discard channel is provided, but if so, it will still apply
97-
* (in such a case, the Message will be sent to the discard channel,
98-
* and <em>then</em> the exception will be thrown).
96+
* Typically this value would <em>not</em> be <code>true</code> when
97+
* a discard channel is provided, but if it is, it will cause the
98+
* exception to be thrown <em>after</em>
99+
* the Message is sent to the discard channel,
99100
* @param throwExceptionOnRejection true if an exception should be thrown.
100101
* @see #setDiscardChannel(MessageChannel)
101102
*/
@@ -105,7 +106,7 @@ public void setThrowExceptionOnRejection(boolean throwExceptionOnRejection) {
105106

106107
/**
107108
* Specify a channel where rejected Messages should be sent. If the discard
108-
* channel is null (the default), rejected Messages will be enriched with
109+
* channel is null (the default), duplicate Messages will be enriched with
109110
* {@link IntegrationMessageHeaderAccessor#DUPLICATE_MESSAGE} header
110111
* and returned as normal to the {@code invocation.proceed()}. However,
111112
* the 'throwExceptionOnRejection' flag determines whether rejected Messages

spring-integration-core/src/main/java/org/springframework/integration/metadata/ExpressionMetadataKeyStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/**
2929
* The expression based {@link MetadataKeyStrategy} implementation.
30-
* The provided {@link Message} is used as a evaluation context root object.
30+
* The provided {@link Message} is used as the evaluation context root object.
3131
*
3232
* @author Artem Bilan
3333
* @since 4.1

spring-integration-core/src/main/java/org/springframework/integration/selector/MetadataStoreSelector.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,31 @@
1717
package org.springframework.integration.selector;
1818

1919
import org.springframework.integration.core.MessageSelector;
20+
import org.springframework.integration.filter.MessageFilter;
21+
import org.springframework.integration.handler.advice.IdempotentReceiverInterceptor;
2022
import org.springframework.integration.metadata.ConcurrentMetadataStore;
2123
import org.springframework.integration.metadata.MetadataKeyStrategy;
2224
import org.springframework.integration.metadata.SimpleMetadataStore;
2325
import org.springframework.messaging.Message;
2426
import org.springframework.util.Assert;
2527

2628
/**
27-
* The {@link MessageSelector} implementation around the {@link ConcurrentMetadataStore}
29+
* The {@link MessageSelector} implementation using a {@link ConcurrentMetadataStore}
2830
* and {@link MetadataKeyStrategy}.
2931
* <p>
3032
* The {@link #accept} method extracts {@code metadataKey} from the provided {@code message}
31-
* using {@link MetadataKeyStrategy} and use {@code id} header as a {@code value}.
33+
* using {@link MetadataKeyStrategy} and uses the {@code id} header as the {@code value}.
3234
* <p>
3335
* The successful result of the {@link #accept} method is based on the
34-
* {@link ConcurrentMetadataStore#putIfAbsent} return value. The {@code true} is returned
35-
* from this {@link MessageSelector} if {@code putIfAbsent} has returned {@code null}.
36-
* And at the same time it means that the value is placed to the {@code MetadataStore}.
36+
* {@link ConcurrentMetadataStore#putIfAbsent} return value. {@code true} is returned
37+
* {@link MessageSelector} if {@code putIfAbsent} returns {@code null}.
38+
* And, at the same time it means that the value has been placed to the {@code MetadataStore}.
3739
* Otherwise the messages isn't accepted because there is already a value in the
3840
* {@code MetadataStore} associated with the {@code key}.
3941
* <p>
40-
* This {@link MessageSelector} is useful for the custom
42+
* This {@link MessageSelector} is useful for an
4143
* <a href="http://www.eaipatterns.com/IdempotentReceiver.html">Idempotent Receiver</a>
42-
* implementation.
44+
* implementation. It can be used in a {@link MessageFilter} or {@link IdempotentReceiverInterceptor}.
4345
*
4446
* @author Artem Bilan
4547
* @since 4.1

spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-4.1.xsd

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,7 +4315,8 @@ The list of component name patterns you want to track (e.g., tracked-components
43154315
<xsd:documentation>
43164316
Consumer Endpoint name(s) or patterns. To specify more than one name(pattern) use ',' 
43174317
(e.g. endpoint="xxx, xxx*, *xxx, *xxx*, xxx*yyy").
4318-
The endpoint 'id' is used to retrieve the target 'MessageHandler' bean via '.handler' suffix,
4318+
The endpoint 'id' is used to retrieve the target endpoint's
4319+
'MessageHandler' bean (using its '.handler' suffix),
43194320
for which the 'IdempotentReceiverInterceptor' will be applied.
43204321
</xsd:documentation>
43214322
</xsd:annotation>
@@ -4328,7 +4329,7 @@ The list of component name patterns you want to track (e.g., tracked-components
43284329
</tool:annotation>
43294330
</xsd:appinfo>
43304331
<xsd:documentation>
4331-
The 'MessageSelector' reference. Used to identify if the message should be accepted
4332+
A 'MessageSelector' reference. Used to identify if the message should be accepted
43324333
by the target 'MessageHandler' endpoint.
43334334
Mutually exclusive with 'metadata-store' and 'key-strategy' or 'key-expression'.
43344335
</xsd:documentation>
@@ -4342,7 +4343,7 @@ The list of component name patterns you want to track (e.g., tracked-components
43424343
</tool:annotation>
43434344
</xsd:appinfo>
43444345
<xsd:documentation>
4345-
The 'MetadataStore' reference. Used for underlying
4346+
The 'MetadataStore' reference. Used for an underlying
43464347
'org.springframework.integration.selector.MetadataStoreSelector'.
43474348
Mutually exclusive with 'selector'.
43484349
Optional. By default 'MetadataStoreSelector' uses an internal 'SimpleMetadataStore'.
@@ -4357,9 +4358,9 @@ The list of component name patterns you want to track (e.g., tracked-components
43574358
</tool:annotation>
43584359
</xsd:appinfo>
43594360
<xsd:documentation>
4360-
The 'MetadataKeyStrategy' reference. Used for underlying
4361+
The 'MetadataKeyStrategy' reference. Used by the underlying
43614362
'org.springframework.integration.selector.MetadataStoreSelector'.
4362-
Evaluates an 'idempotentKey' against request Message.
4363+
Evaluates an 'idempotentKey' from the request Message.
43634364
Mutually exclusive with 'selector' and 'key-expression'.
43644365
</xsd:documentation>
43654366
</xsd:annotation>
@@ -4368,8 +4369,8 @@ The list of component name patterns you want to track (e.g., tracked-components
43684369
<xsd:annotation>
43694370
<xsd:documentation><![CDATA[
43704371
Expression to populate an 'org.springframework.integration.metadata.ExpressionMetadataKeyStrategy'.
4371-
Used for underlying 'org.springframework.integration.selector.MetadataStoreSelector'.
4372-
Evaluates an 'idempotentKey' against request Message as evaluation context root object.
4372+
Used by the underlying 'org.springframework.integration.selector.MetadataStoreSelector'.
4373+
Evaluates an 'idempotentKey' using the request Message as the evaluation context root object.
43734374
Mutually exclusive with 'selector' and 'key-strategy'.
43744375
]]></xsd:documentation>
43754376
</xsd:annotation>
@@ -4383,14 +4384,16 @@ The list of component name patterns you want to track (e.g., tracked-components
43834384
</xsd:appinfo>
43844385
<xsd:documentation>
43854386
Identifies the channel to send a message when 'IdempotentReceiverInterceptor' doesn't accept
4386-
the message.
4387+
the message. When omitted, duplicate messages are forwarded to the handler with a
4388+
'DUPLICATE_MESSAGE' header.
43874389
</xsd:documentation>
43884390
</xsd:annotation>
43894391
</xsd:attribute>
43904392
<xsd:attribute name="throw-exception-on-rejection" type="xsd:string">
43914393
<xsd:annotation>
43924394
<xsd:documentation>
43934395
Throw an exception if the 'IdempotentReceiverInterceptor' rejects the message (default false).
4396+
It is applied regardless of whether or not a discard channel is provided.
43944397
</xsd:documentation>
43954398
</xsd:annotation>
43964399
</xsd:attribute>

src/reference/docbook/whats-new.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@
4444
<section id="4.1-idempotent-receiver">
4545
<title>Idempotent Receiver Pattern</title>
4646
<para>
47-
The <emphasis>Idempotent Receiver</emphasis> EIP pattern implementation is now provided.
48-
It is presented as <code>&lt;idempotent-receiver&gt;</code> component and
47+
The <emphasis>Idempotent Receiver</emphasis> EIP implementation is now provided
48+
via the <code>&lt;idempotent-receiver&gt;</code> component in XML, or the
4949
<classname>IdempotentReceiverInterceptor</classname> and
50-
<interfacename>IdempotentReceiver</interfacename> annotation pair.
50+
<interfacename>IdempotentReceiver</interfacename> annotation when using Java
51+
Configuration.
5152
See <xref linkend="idempotent-receiver"/> and their JavaDocs for more information.
5253
</para>
5354
</section>

0 commit comments

Comments
 (0)