You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/messaging/pulsar.adoc
+2-64Lines changed: 2 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,9 @@
3
3
4
4
https://pulsar.apache.org/[Apache Pulsar] is supported by providing auto-configuration of the {url-spring-pulsar-site}[Spring for Apache Pulsar] project.
5
5
6
-
Spring Boot will auto-configure and register the classic (imperative) Spring for Apache Pulsar components when `org.springframework.pulsar:spring-pulsar` is on the classpath.
7
-
It will do the same for the reactive components when `org.springframework.pulsar:spring-pulsar-reactive` is on the classpath.
6
+
Spring Boot will auto-configure and register the Spring for Apache Pulsar components when `org.springframework.pulsar:spring-pulsar` is on the classpath.
8
7
9
-
There are `spring-boot-starter-pulsar` and `spring-boot-starter-pulsar-reactive` starters for conveniently collecting the dependencies for imperative and reactive use, respectively.
8
+
There is the `spring-boot-starter-pulsar` starterfor conveniently collecting the dependencies for use.
10
9
11
10
12
11
@@ -68,14 +67,6 @@ You can follow {url-spring-pulsar-docs}/reference/pulsar/pulsar-client.html#tls-
68
67
69
68
For complete details on the client and authentication see the Spring for Apache Pulsar {url-spring-pulsar-docs}/reference/pulsar/pulsar-client.html[reference documentation].
70
69
71
-
[[messaging.pulsar.connecting-reactive]]
72
-
== Connecting to Pulsar Reactively
73
-
74
-
When the Reactive auto-configuration is activated, Spring Boot will auto-configure and register a javadoc:org.apache.pulsar.reactive.client.api.ReactivePulsarClient[] bean.
75
-
76
-
The javadoc:org.apache.pulsar.reactive.client.api.ReactivePulsarClient[] adapts an instance of the previously described javadoc:org.apache.pulsar.client.api.PulsarClient[].
77
-
Therefore, follow the previous section to configure the javadoc:org.apache.pulsar.client.api.PulsarClient[] used by the javadoc:org.apache.pulsar.reactive.client.api.ReactivePulsarClient[].
78
-
79
70
80
71
81
72
[[messaging.pulsar.admin]]
@@ -120,25 +111,6 @@ If you need more control over the message being sent, you can pass in a javadoc:
120
111
121
112
122
113
123
-
[[messaging.pulsar.sending-reactive]]
124
-
== Sending a Message Reactively
125
-
126
-
When the Reactive auto-configuration is activated, Spring's javadoc:org.springframework.pulsar.reactive.core.ReactivePulsarTemplate[] is auto-configured, and you can use it to send messages, as shown in the following example:
127
-
128
-
include-code::MyBean[]
129
-
130
-
The javadoc:org.springframework.pulsar.reactive.core.ReactivePulsarTemplate[] relies on a javadoc:org.springframework.pulsar.reactive.core.ReactivePulsarSenderFactory[] to actually create the underlying sender.
131
-
Spring Boot auto-configuration also provides this sender factory, which by default, caches the producers that it creates.
132
-
You can configure the sender factory and cache settings by specifying any of the `spring.pulsar.producer.\*` and `spring.pulsar.producer.cache.*` prefixed application properties.
133
-
134
-
If you need more control over the sender factory configuration, consider registering one or more javadoc:org.springframework.pulsar.reactive.core.ReactiveMessageSenderBuilderCustomizer[] beans.
135
-
These customizers are applied to all created senders.
136
-
You can also pass in a javadoc:org.springframework.pulsar.reactive.core.ReactiveMessageSenderBuilderCustomizer[] when sending a message to only affect the current sender.
137
-
138
-
If you need more control over the message being sent, you can pass in a javadoc:org.springframework.pulsar.reactive.core.MessageSpecBuilderCustomizer[] when sending a message.
139
-
140
-
141
-
142
114
[[messaging.pulsar.receiving]]
143
115
== Receiving a Message
144
116
@@ -156,22 +128,7 @@ You can also customize a single listener by setting the `consumerCustomizer` att
156
128
157
129
If you need more control over the actual container factory configuration, consider registering one or more `PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactory<?>>` beans.
158
130
159
-
[[messaging.pulsar.receiving-reactive]]
160
-
== Receiving a Message Reactively
161
-
162
-
When the Apache Pulsar infrastructure is present and the Reactive auto-configuration is activated, any bean can be annotated with javadoc:org.springframework.pulsar.reactive.config.annotation.ReactivePulsarListener[format=annotation] to create a reactive listener endpoint.
163
-
The following component creates a reactive listener endpoint on the `someTopic` topic:
164
-
165
-
include-code::MyBean[]
166
-
167
-
Spring Boot auto-configuration provides all the components necessary for javadoc:org.springframework.pulsar.reactive.config.annotation.ReactivePulsarListener[], such as the javadoc:org.springframework.pulsar.reactive.config.ReactivePulsarListenerContainerFactory[] and the consumer factory it uses to construct the underlying reactive Pulsar consumers.
168
-
You can configure these components by specifying any of the `spring.pulsar.listener.\*` and `spring.pulsar.consumer.*` prefixed application properties.
169
-
170
-
If you need more control over the configuration of the consumer factory, consider registering one or more javadoc:org.springframework.pulsar.reactive.core.ReactiveMessageConsumerBuilderCustomizer[] beans.
171
-
These customizers are applied to all consumers created by the factory, and therefore all javadoc:org.springframework.pulsar.reactive.config.annotation.ReactivePulsarListener[format=annotation] instances.
172
-
You can also customize a single listener by setting the `consumerCustomizer` attribute of the javadoc:org.springframework.pulsar.reactive.config.annotation.ReactivePulsarListener[format=annotation] annotation.
173
131
174
-
If you need more control over the actual container factory configuration, consider registering one or more `PulsarContainerFactoryCustomizer<DefaultReactivePulsarListenerContainerFactory<?>>` beans.
175
132
176
133
[[messaging.pulsar.reading]]
177
134
== Reading a Message
@@ -193,23 +150,6 @@ You can also customize a single listener by setting the `readerCustomizer` attri
193
150
194
151
If you need more control over the actual container factory configuration, consider registering one or more `PulsarContainerFactoryCustomizer<DefaultPulsarReaderContainerFactory<?>>` beans.
195
152
196
-
197
-
[[messaging.pulsar.reading-reactive]]
198
-
== Reading a Message Reactively
199
-
200
-
When the Apache Pulsar infrastructure is present and the Reactive auto-configuration is activated, Spring's javadoc:org.springframework.pulsar.reactive.core.ReactivePulsarReaderFactory[] is provided, and you can use it to create a reader in order to read messages in a reactive fashion.
201
-
The following component creates a reader using the provided factory and reads a single message from 5 minutes ago from the `someTopic` topic:
202
-
203
-
include-code::MyBean[]
204
-
205
-
Spring Boot auto-configuration provides this reader factory which can be customized by setting any of the `spring.pulsar.reader.*` prefixed application properties.
206
-
207
-
If you need more control over the reader factory configuration, consider passing in one or more javadoc:org.springframework.pulsar.reactive.core.ReactiveMessageReaderBuilderCustomizer[] instances when using the factory to create a reader.
208
-
209
-
If you need more control over the reader factory configuration, consider registering one or more javadoc:org.springframework.pulsar.reactive.core.ReactiveMessageReaderBuilderCustomizer[] beans.
210
-
These customizers are applied to all created readers.
211
-
You can also pass one or more javadoc:org.springframework.pulsar.reactive.core.ReactiveMessageReaderBuilderCustomizer[] when creating a reader to only apply the customizations to the created reader.
212
-
213
153
TIP: For more details on any of the above components and to discover other available features, see the Spring for Apache Pulsar {url-spring-pulsar-docs}[reference documentation].
214
154
215
155
@@ -219,8 +159,6 @@ TIP: For more details on any of the above components and to discover other avail
219
159
220
160
Spring for Apache Pulsar supports transactions when using javadoc:org.springframework.pulsar.core.PulsarTemplate[] and javadoc:org.springframework.pulsar.annotation.PulsarListener[format=annotation].
221
161
222
-
NOTE: Transactions are not currently supported when using the reactive variants.
223
-
224
162
Setting the configprop:spring.pulsar.transaction.enabled[] property to `true` will:
225
163
226
164
* Configure a javadoc:org.springframework.pulsar.transaction.PulsarTransactionManager[] bean
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/messaging/pulsar/readingreactive/MyBean.java
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/messaging/pulsar/receivingreactive/MyBean.java
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/messaging/pulsar/sendingreactive/MyBean.java
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/messaging/pulsar/readingreactive/MyBean.kt
0 commit comments