Skip to content

Commit 645e448

Browse files
authored
Add tests for SpEL attributes (spring-projects#549)
For each of @PulsarListener, @PulsarReader, @ReactivePulsarListener: * Add tests for SpEL attributes * Update Javadocs for SpEL attributes Resolves spring-projects#86
1 parent 2066212 commit 645e448

File tree

6 files changed

+1142
-48
lines changed

6 files changed

+1142
-48
lines changed

spring-pulsar-reactive/src/main/java/org/springframework/pulsar/reactive/config/annotation/ReactivePulsarListener.java

+30-21
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import org.apache.pulsar.common.schema.SchemaType;
2727

2828
import org.springframework.messaging.handler.annotation.MessageMapping;
29+
import org.springframework.pulsar.config.PulsarListenerContainerFactory;
2930
import org.springframework.pulsar.reactive.config.ReactivePulsarListenerContainerFactory;
3031
import org.springframework.pulsar.reactive.config.ReactivePulsarListenerEndpointRegistry;
31-
import org.springframework.pulsar.reactive.core.ReactiveMessageConsumerBuilderCustomizer;
3232

3333
/**
3434
* Annotation that marks a method to be the target of a Pulsar message listener on the
@@ -67,7 +67,9 @@
6767

6868
/**
6969
* Pulsar subscription name associated with this listener.
70-
* @return the {@code subscriptionName} for this Pulsar listener endpoint.
70+
* <p>
71+
* SpEL {@code #{...}} and property placeholders {@code ${...}} are supported.
72+
* @return the subscription name for this listener
7173
*/
7274
String subscriptionName() default "";
7375

@@ -86,8 +88,8 @@
8688
SchemaType schemaType() default SchemaType.NONE;
8789

8890
/**
89-
* The bean name of the {@link ReactivePulsarListenerContainerFactory} to use to
90-
* create the message listener container responsible to serve this endpoint.
91+
* The bean name of the {@link PulsarListenerContainerFactory} to use to create the
92+
* message listener container responsible to serve this endpoint.
9193
* <p>
9294
* If not specified, the default container factory is used, if any. If a SpEL
9395
* expression is provided ({@code #{...}}), the expression can either evaluate to a
@@ -98,24 +100,28 @@
98100

99101
/**
100102
* Topics to listen to.
101-
* @return a comma separated list of topics to listen from.
103+
* <p>
104+
* SpEL {@code #{...}} and property placeholders {@code ${...}} are supported.
105+
* @return an array of topics to listen to
102106
*/
103107
String[] topics() default {};
104108

105109
/**
106110
* Topic patten to listen to.
107-
* @return topic pattern to listen to.
111+
* <p>
112+
* SpEL {@code #{...}} and property placeholders {@code ${...}} are supported.
113+
* @return topic pattern to listen to
108114
*/
109115
String topicPattern() default "";
110116

111117
/**
112-
* Set to true or false, to override the default setting in the container factory. May
113-
* be a property placeholder or SpEL expression that evaluates to a {@link Boolean} or
114-
* a {@link String}, in which case the {@link Boolean#parseBoolean(String)} is used to
115-
* obtain the value.
118+
* Whether to automatically start the container for this listener.
116119
* <p>
117-
* SpEL {@code #{...}} and property place holders {@code ${...}} are supported.
118-
* @return true to auto start, false to not auto start.
120+
* The value can be a literal string representation of boolean (e.g. {@code 'true'})
121+
* or a property placeholder {@code ${...}} that resolves to a literal. SpEL
122+
* {@code #{...}} expressions that evaluate to a {@link Boolean} or a literal are
123+
* supported.
124+
* @return whether to automatically start the container for this listener
119125
*/
120126
String autoStartup() default "";
121127

@@ -136,12 +142,13 @@
136142
String beanRef() default "__listener";
137143

138144
/**
139-
* Override the container factory's {@code concurrency} setting for this listener. May
140-
* be a property placeholder or SpEL expression that evaluates to a {@link Number}, in
141-
* which case {@link Number#intValue()} is used to obtain the value.
145+
* Override the container factory's {@code concurrency} setting for this listener.
142146
* <p>
143-
* SpEL {@code #{...}} and property placeholders {@code ${...}} are supported.
144-
* @return the concurrency.
147+
* The value can be a literal string representation of {@link Number} (e.g.
148+
* {@code '3'}) or a property placeholder {@code ${...}} that resolves to a literal.
149+
* SpEL {@code #{...}} expressions that evaluate to a {@link Number} or a literal are
150+
* supported.
151+
* @return the concurrency for this listener
145152
*/
146153
String concurrency() default "";
147154

@@ -158,17 +165,19 @@
158165
String useKeyOrderedProcessing() default "";
159166

160167
/**
161-
* The bean name or a 'SpEL' expression that resolves to a
168+
* The bean name or a SpEL expression that resolves to a
162169
* {@link org.apache.pulsar.client.api.DeadLetterPolicy} to use on the consumer to
163170
* configure a dead letter policy for message redelivery.
164171
* @return the bean name or empty string to not set any dead letter policy.
165172
*/
166173
String deadLetterPolicy() default "";
167174

168175
/**
169-
* The bean name or a 'SpEL' expression that resolves to a
170-
* {@link ReactiveMessageConsumerBuilderCustomizer} to use to configure the consumer.
171-
* @return the bean name or empty string to not configure the consumer.
176+
* The bean name or a SpEL expression that resolves to a
177+
* {@link ReactivePulsarListenerMessageConsumerBuilderCustomizer} to use to configure
178+
* the underlying consumer.
179+
* @return the bean name or SpEL expression to the customizer or an empty string to
180+
* not customize the consumer
172181
*/
173182
String consumerCustomizer() default "";
174183

0 commit comments

Comments
 (0)