WIP
This commit is contained in:
committed by
Oleg Zhurakousky
parent
b642747781
commit
28f9dcb2a2
6
.gitignore
vendored
6
.gitignore
vendored
@@ -25,3 +25,9 @@ dump.rdb
|
||||
.apt_generated
|
||||
artifacts
|
||||
**/dependency-reduced-pom.xml
|
||||
|
||||
node
|
||||
node_modules
|
||||
build
|
||||
package.json
|
||||
package-lock.json
|
||||
|
||||
@@ -6,15 +6,10 @@ antora:
|
||||
- '@antora/collector-extension'
|
||||
- '@antora/atlas-extension'
|
||||
- require: '@springio/antora-extensions/root-component-extension'
|
||||
root_component_name: 'PROJECT_WITHOUT_SPRING'
|
||||
# FIXME: Run antora once using this extension to migrate to the Asciidoc Tabs syntax
|
||||
# and then remove this extension
|
||||
- require: '@springio/antora-extensions/tabs-migration-extension'
|
||||
unwrap_example_block: always
|
||||
save_result: true
|
||||
root_component_name: 'cloud-stream'
|
||||
site:
|
||||
title: PROJECT_FULL_NAME
|
||||
url: https://docs.spring.io/PROJECT_NAME/reference/
|
||||
title: Spring Cloud Stream
|
||||
url: https://docs.spring.io/spring-cloud-stream/reference/
|
||||
content:
|
||||
sources:
|
||||
- url: ./..
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: PROJECT_WITHOUT_SPRING
|
||||
name: cloud-stream
|
||||
version: true
|
||||
title: PROJECT_NAME
|
||||
title: spring-cloud-stream
|
||||
nav:
|
||||
- modules/ROOT/nav.adoc
|
||||
ext:
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|===
|
||||
|Name | Default | Description
|
||||
|
||||
|spring.cloud.stream.binders | | Additional per-binder properties (see {@link BinderProperties}) if more then one binder of the same type is used (i.e., connect to multiple instances of RabbitMq). Here you can specify multiple binder configurations, each with different environment settings. For example; spring.cloud.stream.binders.rabbit1.environment. . . , spring.cloud.stream.binders.rabbit2.environment. . .
|
||||
|spring.cloud.stream.binding-retry-interval | `+++30+++` | Retry interval (in seconds) used to schedule binding attempts. Default: 30 sec.
|
||||
|spring.cloud.stream.bindings | | Additional binding properties (see {@link BinderProperties}) per binding name (e.g., 'input`). For example; This sets the content-type for the 'input' binding of a Sink application: 'spring.cloud.stream.bindings.input.contentType=text/plain'
|
||||
|spring.cloud.stream.default-binder | | The name of the binder to use by all bindings in the event multiple binders available (e.g., 'rabbit').
|
||||
|spring.cloud.stream.dynamic-destination-cache-size | `+++10+++` | The maximum size of Least Recently Used (LRU) cache of dynamic destinations. Once this size is reached, new destinations will trigger the removal of old destinations. Default: 10
|
||||
|spring.cloud.stream.dynamic-destinations | `+++[]+++` | A list of destinations that can be bound dynamically. If set, only listed destinations can be bound.
|
||||
|spring.cloud.stream.function.bindings | |
|
||||
|spring.cloud.stream.input-bindings | | A semi-colon delimited string to explicitly define input bindings (specifically for cases when there is no implicit trigger to create such bindings such as Function, Supplier or Consumer).
|
||||
|spring.cloud.stream.instance-count | `+++1+++` | The number of deployed instances of an application. Default: 1. NOTE: Could also be managed per individual binding "spring.cloud.stream.bindings.foo.consumer.instance-count" where 'foo' is the name of the binding.
|
||||
|spring.cloud.stream.instance-index | `+++0+++` | The instance id of the application: a number from 0 to instanceCount-1. Used for partitioning and with Kafka. NOTE: Could also be managed per individual binding "spring.cloud.stream.bindings.foo.consumer.instance-index" where 'foo' is the name of the binding.
|
||||
|spring.cloud.stream.instance-index-list | | A list of instance id's from 0 to instanceCount-1. Used for partitioning and with Kafka. NOTE: Could also be managed per individual binding "spring.cloud.stream.bindings.foo.consumer.instance-index-list" where 'foo' is the name of the binding. This setting will override the one set in 'spring.cloud.stream.instance-index'
|
||||
|spring.cloud.stream.integration.message-handler-not-propagated-headers | | Message header names that will NOT be copied from the inbound message.
|
||||
|spring.cloud.stream.output-bindings | | A semi-colon delimited string to explicitly define output bindings (specifically for cases when there is no implicit trigger to create such bindings such as Function, Supplier or Consumer).
|
||||
|spring.cloud.stream.override-cloud-connectors | `+++false+++` | This property is only applicable when the cloud profile is active and Spring Cloud Connectors are provided with the application. If the property is false (the default), the binder detects a suitable bound service (for example, a RabbitMQ service bound in Cloud Foundry for the RabbitMQ binder) and uses it for creating connections (usually through Spring Cloud Connectors). When set to true, this property instructs binders to completely ignore the bound services and rely on Spring Boot properties (for example, relying on the spring.rabbitmq.* properties provided in the environment for the RabbitMQ binder). The typical usage of this property is to be nested in a customized environment when connecting to multiple systems.
|
||||
|spring.cloud.stream.pollable-source | `+++none+++` | A semi-colon delimited list of binding names of pollable sources. Binding names follow the same naming convention as functions. For example, name '...pollable-source=foobar' will be accessible as 'foobar-iin-0'' binding
|
||||
|spring.cloud.stream.sendto.destination | `+++none+++` | The name of the header used to determine the name of the output destination
|
||||
|spring.cloud.stream.source | | A semi-colon delimited string representing the names of the sources based on which source bindings will be created. This is primarily to support cases where source binding may be required without providing a corresponding Supplier. (e.g., for cases where the actual source of data is outside of scope of spring-cloud-stream - HTTP -> Stream) @deprecated use {@link #outputBindings}
|
||||
|
||||
|===
|
||||
6
docs/modules/ROOT/pages/configprops.adoc
Normal file
6
docs/modules/ROOT/pages/configprops.adoc
Normal file
@@ -0,0 +1,6 @@
|
||||
[[configuration-properties]]
|
||||
= Configuration Properties
|
||||
|
||||
Below you can find a list of configuration properties.
|
||||
|
||||
include::partial$_configprops.adoc[]
|
||||
@@ -22,7 +22,6 @@ Following are the maven coordinates for the reactive Kafka binder.
|
||||
|
||||
In this section, we show some basic code snippets for writing a reactive Kafka application using the reactive binder and details around them.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -30,7 +29,6 @@ public Function<Flux<String>, Flux<String>> uppercase() {
|
||||
return s -> s.map(String::toUpperCase);
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
You can use the above `upppercase` function with both message channel based Kafka binder (`spring-cloud-stream-binder-kafka`) as well as the reactive Kafka binder (`spring-cloud-stream-binder-kafka-reactive`), the topic of discussion in this section.
|
||||
When using this function with the regular Kafka binder, although you are using reactive types in the application (i.e., in the `uppercase` function), you only get the reactive streams within the execution of your function.
|
||||
@@ -52,7 +50,6 @@ The interfaces extend `Ordered` so the customizers will be applied in the order
|
||||
IMPORTANT: The binder does not commit offsets by default.
|
||||
Starting with version 4.0.2, the `KafkaHeaders.ACKNOWLEDGMENT` header contains a `ReceiverOffset` object which allows you to cause the offset to be committed by calling its `acknowledge()` or `commit()` methods.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -63,7 +60,6 @@ public Consumer<Flux<Message<String>> consume() {
|
||||
}
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Refer to the `reactor-kafka` documentation and javadocs for more information.
|
||||
|
||||
@@ -75,7 +71,6 @@ IMPORTANT: 4.0.2 also provided `reactiveAutoCommit`, but the implementation was
|
||||
|
||||
The following is an example of how to use `reaciveAutoCommit`.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -89,7 +84,6 @@ Consumer<Flux<Flux<ConsumerRecord<?, String>>>> input() {
|
||||
.subscribe();
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Note that `reactor-kafka` returns a `Flux<Flux<ConsumerRecord<?, ?>>>` when using auto commit.
|
||||
Given that Spring has no access to the contents of the inner flux, the application must deal with the native `ConsumerRecord`; there is no message conversion or conversion service applied to the contents.
|
||||
@@ -102,7 +96,6 @@ In the above `upppercase` function, we are consuming the record as `Flux<String>
|
||||
There might be occasions in which you need to receive the record in the original received format - the `ReceiverRecord`.
|
||||
Here is such a function.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -110,7 +103,6 @@ public Function<Flux<ReceiverRecord<byte[], byte[]>>, Flux<String>> lowercase()
|
||||
return s -> s.map(rec -> new String(rec.value()).toLowerCase());
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
In this function, note that, we are consuming the record as `Flux<ReceiverRecord<byte[], byte[]>>` and then producing it as `Flux<String>`.
|
||||
`ReceiverRecord` is the basic received record which is a specialized Kafka `ConsumerRecord` in Reactor Kafka.
|
||||
@@ -121,7 +113,6 @@ Therefore, by the time your handler method receives it, the payload is already e
|
||||
By providing a custom `RecordMessageConverter` implementation in the application, you can override the default behavior.
|
||||
For example, if you want to consume the record as raw `Flux<ReceiverRecord<byte[], byte[]>>`, then you can provide the following bean definition in the application.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -144,7 +135,6 @@ RecordMessageConverter fullRawReceivedRecord() {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Then, you need to instruct the framework to use this converter for the required binding.
|
||||
Here is an example based on our `lowercase` function.
|
||||
@@ -201,7 +191,6 @@ The `resultMetadataChannel` **must** be a `FluxMessageChannel` instance.
|
||||
|
||||
Here is an example of how to use this feature, with correlation metadata of type `Integer`:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -219,18 +208,15 @@ void handleResults(SenderResult<Integer> result) {
|
||||
}
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
To set the correlation metadata on an output record, set the `CORRELATION_ID` header:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
streamBridge.send("words1", MessageBuilder.withPayload("foobar")
|
||||
.setCorrelationId(42)
|
||||
.build());
|
||||
----
|
||||
====
|
||||
|
||||
When using the feature with a `Function`, the function output type must be a `Message<?>` with the correlation id header set to the desired value.
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ Only one such bean can be present.
|
||||
The function is provided with the consumer group, the failed `ConsumerRecord` and the exception.
|
||||
For example, if you always want to route to partition 0, you might use:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -20,7 +19,6 @@ public DlqPartitionFunction partitionFunction() {
|
||||
return (group, record, ex) -> 0;
|
||||
}
|
||||
----
|
||||
====
|
||||
NOTE: If you set a consumer binding's `dlqPartitions` property to 1 (and the binder's `minPartitionCount` is equal to `1`), there is no need to supply a `DlqPartitionFunction`; the framework will always use partition 0.
|
||||
If you set a consumer binding's `dlqPartitions` property to a value greater than `1` (or the binder's `minPartitionCount` is greater than `1`), you **must** provide a `DlqPartitionFunction` bean, even if the partition count is the same as the original topic's.
|
||||
|
||||
@@ -30,7 +28,6 @@ When the binder detects such a bean, that takes precedence, otherwise it will us
|
||||
If neither of these are found, it will default to `error.<destination>.<group>`.
|
||||
Here is an example of `DlqDestinationResolver` as a `@Bean`.
|
||||
|
||||
====
|
||||
[source]
|
||||
----
|
||||
@Bean
|
||||
@@ -45,7 +42,6 @@ public DlqDestinationResolver dlqDestinationResolver() {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
One important thing to keep in mind when providing an implementation for `DlqDestinationResolver` is that the provisioner in the binder will not auto create topics for the application.
|
||||
This is because there is no way for the binder to infer the names of all the DLQ topics the implementation might send to.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
Applications may wish to seek topics/partitions to arbitrary offsets when the partitions are initially assigned, or perform other operations on the consumer.
|
||||
Starting with version 2.1, if you provide a single `KafkaBindingRebalanceListener` bean in the application context, it will be wired into all Kafka consumer bindings.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
public interface KafkaBindingRebalanceListener {
|
||||
@@ -45,7 +44,6 @@ public interface KafkaBindingRebalanceListener {
|
||||
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
You cannot set the `resetOffsets` consumer property to `true` when you provide a rebalance listener.
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ There are situations where it is preferable to move this functionality to the li
|
||||
To configure moving this functionality from the binder to the container, define a `@Bean` of type `ListenerContainerWithDlqAndRetryCustomizer`.
|
||||
This interface has the following methods:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
/**
|
||||
@@ -43,11 +42,9 @@ default boolean retryAndDlqInBinding(String destinationName, String group) {
|
||||
return true;
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
The destination resolver and `BackOff` are created from the binding properties (if configured). The `KafkaTemplate` uses configuration from `spring.kafka....` properties. You can then use these to create a custom error handler and dead letter publisher; for example:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -75,13 +72,11 @@ ListenerContainerWithDlqAndRetryCustomizer cust(KafkaTemplate<?, ?> template) {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Now, only a single retry delay needs to be greater than the consumer's `max.poll.interval.ms` property.
|
||||
|
||||
When working with several binders, the 'ListenerContainerWithDlqAndRetryCustomizer' bean gets overridden by the 'DefaultBinderFactory'. For the bean
|
||||
to apply, you need to use a 'BinderCustomizer' to set the container customizer (See xref:spring-cloud-stream/binder-customizer.adoc[Customizing binders in multi binder applications]):
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -99,5 +94,4 @@ public BinderCustomizer binderCustomizer(ListenerContainerWithDlqAndRetryCustomi
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
When using compacted topics, a record with a `null` value (also called a tombstone record) represents the deletion of a key.
|
||||
To receive such messages in a Spring Cloud Stream function, you can use the following strategy.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -22,5 +21,4 @@ public Function<Message<Person>, String> myFunction() {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ Similarly, instead of publishing dead-letter records within the transaction, thi
|
||||
|
||||
If you wish to use transactions in a source application, or from some arbitrary thread for producer-only transaction (e.g. `@Scheduled` method), you must get a reference to the transactional producer factory and define a `KafkaTransactionManager` bean using it.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -26,7 +25,6 @@ public PlatformTransactionManager transactionManager(BinderFactory binders,
|
||||
return tm;
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Notice that we get a reference to the binder using the `BinderFactory`; use `null` in the first argument when there is only one binder configured.
|
||||
If more than one binder is configured, use the binder name to get the reference.
|
||||
@@ -34,7 +32,6 @@ Once we have a reference to the binder, we can obtain a reference to the `Produc
|
||||
|
||||
Then you would use normal Spring transaction support, e.g. `TransactionTemplate` or `@Transactional`, for example:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
public static class Sender {
|
||||
@@ -46,7 +43,6 @@ public static class Sender {
|
||||
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
If you wish to synchronize producer-only transactions with those from some other transaction manager, use a `ChainedTransactionManager`.
|
||||
|
||||
|
||||
@@ -9,8 +9,11 @@ In this section, we will go through the basic details of this binder.
|
||||
|
||||
We need to include the following dependency on your application to use Apache Pulsar binder for Spring Cloud Stream.
|
||||
|
||||
[tabs]
|
||||
======
|
||||
Maven::
|
||||
+
|
||||
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
|
||||
.Maven
|
||||
----
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -21,13 +24,15 @@ We need to include the following dependency on your application to use Apache Pu
|
||||
</dependencies>
|
||||
----
|
||||
|
||||
Gradle::
|
||||
+
|
||||
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
|
||||
.Gradle
|
||||
----
|
||||
dependencies {
|
||||
implementation 'org.springframework.pulsar:spring-pulsar-spring-cloud-stream-binder:{spring-pulsar-version}'
|
||||
}
|
||||
----
|
||||
======
|
||||
|
||||
[[overview]]
|
||||
== Overview
|
||||
@@ -39,7 +44,6 @@ Applications can start from a middleware-neutral manner and then map Pulsar topi
|
||||
Spring Cloud Stream is built on top of Spring Boot, and when writing an event-driven microservice using Spring Cloud Stream, you are essentially writing a Boot application.
|
||||
Here is a straightforward Spring Cloud Stream application.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@SpringBootApplication
|
||||
@@ -79,7 +83,6 @@ public class SpringPulsarBinderSampleApp {
|
||||
}
|
||||
|
||||
----
|
||||
====
|
||||
|
||||
The above sample application, a full-blown Spring Boot application, deserves a few explanations. However, on a first pass, you can see that this is just plain Java and a few Spring and Spring Boot annotations.
|
||||
We have three `Bean` methods here - a `java.util.function.Supplier`, a `java.util.function.Function`, and finally, a `java.util.function.Consumer`.
|
||||
|
||||
@@ -9,7 +9,6 @@ This is particularly useful with a batch listener because you can send multiple
|
||||
To use this technique, set the `useConfirmHeader` property to true
|
||||
The following simple application is an example of using this technique:
|
||||
|
||||
====
|
||||
[source, properties]
|
||||
----
|
||||
spring.cloud.stream.bindings.input-in-0.group=someGroup
|
||||
@@ -25,9 +24,7 @@ spring.cloud.stream.rabbit.bindings.input-in-0.consumer.batch-size=10
|
||||
spring.rabbitmq.publisher-confirm-type=correlated
|
||||
spring.rabbitmq.publisher-returns=true
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@SpringBootApplication
|
||||
@@ -106,7 +103,6 @@ class MyCorrelationData extends CorrelationData {
|
||||
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
As you can see, we send each message and then await for the publication results.
|
||||
If the messages can't be routed, then correlation data is populated with the returned message before the future is completed.
|
||||
|
||||
@@ -10,7 +10,6 @@ Only a single stream queue can be consumed by each binding.
|
||||
To configure the binder to use `containerType=stream`, Spring Boot will automatically configure an `Environment` `@Bean` from the application properties.
|
||||
You can, optionally, add a customizer to customize the listener container.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -24,7 +23,6 @@ ListenerContainerCustomizer<MessageListenerContainer> customizer() {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
The `name` argument passed to the customizer is `destination + '.' + group + '.container'`.
|
||||
|
||||
@@ -32,7 +30,6 @@ The stream `name()` (for the purpose of offset tracking) is set to the binding `
|
||||
It can be changed using a `ConsumerCustomizer` shown above.
|
||||
If you decide to use manual offset tracking, the `Context` is available as a message header:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
int count;
|
||||
@@ -48,7 +45,6 @@ public Consumer<Message<?>> input() {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Refer to the https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle/[RabbitMQ Stream Java Client documentation] for information about configuring the environment and consumer builder.
|
||||
|
||||
@@ -61,7 +57,6 @@ Use of super streams allows for automatic scale-up scale-down with a single acti
|
||||
|
||||
Configuration example:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -69,9 +64,7 @@ public Consumer<Thing> input() {
|
||||
...
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
[source, properties]
|
||||
----
|
||||
spring.cloud.stream.bindings.input-in-0.destination=super
|
||||
@@ -81,7 +74,6 @@ spring.cloud.stream.bindings.input-in-0.consumer.concurrency=3
|
||||
spring.cloud.stream.rabbit.bindings.input-in-0.consumer.container-type=STREAM
|
||||
spring.cloud.stream.rabbit.bindings.input-in-0.consumer.super-stream=true
|
||||
----
|
||||
====
|
||||
|
||||
The framework will create a super stream named `super`, with 9 partitions.
|
||||
Up to 3 instances of this application can be deployed.
|
||||
|
||||
@@ -9,7 +9,6 @@ IMPORTANT: The producer properties described above are not supported when you se
|
||||
To configure the binder to use a stream `ProducerType`, Spring Boot will configure an `Environment` `@Bean` from the applicaation properties.
|
||||
You can, optionally, add a customizer to customize the message handler.
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -24,7 +23,6 @@ ProducerMessageHandlerCustomizer<MessageHandler> handlerCustomizer() {
|
||||
};
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
Refer to the https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle/[RabbitMQ Stream Java Client documentation] for information about configuring the environment and producer builder.
|
||||
|
||||
@@ -40,7 +38,6 @@ IMPORTANT: The super stream must already exist; creating a super stream is not s
|
||||
|
||||
Publishing to a super stream over AMQP:
|
||||
|
||||
====
|
||||
[source, properties]
|
||||
----
|
||||
spring.cloud.stream.bindings.output.destination=super
|
||||
@@ -48,11 +45,9 @@ spring.cloud.stream.bindings.output.producer.partition-count=3
|
||||
spring.cloud.stream.bindings.output.producer.partition-key-expression=headers['cust-no']
|
||||
spring.cloud.stream.rabbit.bindings.output.producer.declare-exchange=false
|
||||
----
|
||||
====
|
||||
|
||||
Publishing to a super stream using the stream client:
|
||||
|
||||
====
|
||||
[source, properties]
|
||||
----
|
||||
spring.cloud.stream.bindings.output.destination=super
|
||||
@@ -62,7 +57,6 @@ spring.cloud.stream.rabbit.bindings.output.producer.producer-type=stream-async
|
||||
spring.cloud.stream.rabbit.bindings.output.producer.super-stream=true
|
||||
spring.cloud.stream.rabbit.bindings.output.producer.declare-exchange=false
|
||||
----
|
||||
====
|
||||
|
||||
When using the stream client, if you set a `confirmAckChannel`, a copy of a successfully sent message will be sent to that channel.
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ Starting with version 3.0, any such batch can be presented as a `List<?>` to the
|
||||
Starting with version 3.1, the consumer can be configured to assemble multiple inbound messages into a batch which is presented to the application as a `List<?>` of converted payloads.
|
||||
The following simple application demonstrates how to use this technique:
|
||||
|
||||
====
|
||||
[source, properties]
|
||||
----
|
||||
spring.cloud.stream.bindings.input-in-0.group=someGroup
|
||||
@@ -26,9 +25,7 @@ spring.cloud.stream.rabbit.bindings.input-in-0.consumer.enable-batching=true
|
||||
spring.cloud.stream.rabbit.bindings.input-in-0.consumer.batch-size=10
|
||||
spring.cloud.stream.rabbit.bindings.input-in-0.consumer.receive-timeout=200
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@SpringBootApplication
|
||||
@@ -87,16 +84,13 @@ public class Application {
|
||||
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
[source]
|
||||
----
|
||||
Received 2
|
||||
Thing [field=value1]
|
||||
Thing [field=value2]
|
||||
----
|
||||
====
|
||||
|
||||
The number of messages in a batch is specified by the `batch-size` and `receive-timeout` properties; if the `receive-timeout` elapses with no new messages, a "short" batch is delivered.
|
||||
|
||||
@@ -105,7 +99,6 @@ IMPORTANT: Consumer-side batching is only supported with `container-type=simple`
|
||||
If you wish to examine headers of consumer-side batched messages, you should consume `Message<List<?>>`; the headers are a `List<Map<String, Object>>` in a header `AmqpInboundChannelAdapter.CONSOLIDATED_HEADERS`, with the headers for each payload element in the corresponding index.
|
||||
Again, here is a simple example:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@SpringBootApplication
|
||||
@@ -174,14 +167,11 @@ public class Application {
|
||||
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
[source]
|
||||
----
|
||||
Received 2
|
||||
Thing [field=value1] myHeader=headerValue1
|
||||
Thing [field=value2] myHeader=headerValue2
|
||||
----
|
||||
====
|
||||
|
||||
|
||||
@@ -147,7 +147,6 @@ Similarly, for polled consumers, add a `MessageSourceCustomizer` bean.
|
||||
|
||||
The following is an example for the RabbitMQ binder:
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
@@ -160,7 +159,6 @@ public MessageSourceCustomizer<AmqpMessageSource> sourceCustomizer() {
|
||||
return (source, dest, group) -> source.setPropertiesConverter(customPropertiesConverter);
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
[[producer-properties]]
|
||||
== Producer Properties
|
||||
@@ -240,7 +238,6 @@ In some cases Producer Properties are not enough to properly configure a produci
|
||||
while configuring such producing MessageHandler. Regardless of the reason, spring-cloud-stream provides `ProducerMessageHandlerCustomizer` to accomplish it.
|
||||
|
||||
|
||||
====
|
||||
[source, java]
|
||||
----
|
||||
@FunctionalInterface
|
||||
@@ -260,7 +257,6 @@ public interface ProducerMessageHandlerCustomizer<H extends MessageHandler> {
|
||||
As you can see it gives you access to an actual instance of producing `MessageHandler` which you can configure as you wish.
|
||||
All you need to do is provide implementation of this strategy and configure it as a `@Bean`.
|
||||
|
||||
====
|
||||
|
||||
[[content-type-management]]
|
||||
= Content Type Negotiation
|
||||
|
||||
55
docs/pom.xml
55
docs/pom.xml
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-docs</artifactId>
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@@ -10,14 +11,14 @@
|
||||
<version>4.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<name>spring-cloud-stream-docs</name>
|
||||
<description>Spring Cloud Stream Core Documentation</description>
|
||||
<name>Spring Cloud Stream Docs</name>
|
||||
<description>Spring Cloud Stream Docs</description>
|
||||
<properties>
|
||||
<docs.main>spring-cloud-stream</docs.main>
|
||||
<main.basedir>${basedir}/..</main.basedir>
|
||||
<maven.plugin.plugin.version>3.4</maven.plugin.plugin.version>
|
||||
<configprops.inclusionPattern>.*stream.*</configprops.inclusionPattern>
|
||||
<upload-docs-zip.phase>deploy</upload-docs-zip.phase>
|
||||
<!-- Don't upload docs jar to central / repo.spring.io -->
|
||||
<maven-deploy-plugin-default.phase>none</maven-deploy-plugin-default.phase>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -41,50 +42,36 @@
|
||||
<profile>
|
||||
<id>docs</id>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/antora/resources/antora-resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-component-version-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>readme</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<path id="readme.class.path">
|
||||
<pathelement location="${readme.main.classpath}"/>
|
||||
</path>
|
||||
<java classname="org.springframework.cloud.internal.asciidoctor.ReadmeMain"
|
||||
failonerror="yes" classpathref="${readme.class.path}">
|
||||
<!-- Input -->
|
||||
<arg value="${project.basedir}/src/main/asciidoc/README.adoc"/>
|
||||
<!-- Output -->
|
||||
<arg value="${main.basedir}/../README.adoc"/>
|
||||
</java>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
|
||||
20
docs/src/main/antora/resources/antora-resources/antora.yml
Normal file
20
docs/src/main/antora/resources/antora-resources/antora.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
version: @antora-component.version@
|
||||
prerelease: @antora-component.prerelease@
|
||||
|
||||
asciidoc:
|
||||
attributes:
|
||||
attribute-missing: 'warn'
|
||||
chomp: 'all'
|
||||
project-root: @maven.multiModuleProjectDirectory@
|
||||
github-repo: @docs.main@
|
||||
github-raw: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@
|
||||
github-code: https://github.com/spring-cloud/@docs.main@/tree/@github-tag@
|
||||
github-issues: https://github.com/spring-cloud/@docs.main@/issues/
|
||||
github-wiki: https://github.com/spring-cloud/@docs.main@/wiki
|
||||
spring-cloud-version: @project.version@
|
||||
github-tag: @github-tag@
|
||||
version-type: @version-type@
|
||||
docs-url: https://docs.spring.io/@docs.main@/docs/@project.version@
|
||||
raw-docs-url: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@
|
||||
project-version: @project.version@
|
||||
project-name: @docs.main@
|
||||
@@ -22,7 +22,7 @@ For more information, please visit the https://spring.io/projects/spring-cloud-s
|
||||
[[building]]
|
||||
= Building
|
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/contributing.adoc[]
|
||||
|
||||
[[contributing]]
|
||||
= Contributing
|
||||
Reference in New Issue
Block a user