diff --git a/docs/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml similarity index 100% rename from docs/.github/workflows/deploy-docs.yml rename to .github/workflows/deploy-docs.yml diff --git a/.gitignore b/.gitignore index 214f0bcb3..b53bdbe8f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,9 @@ dump.rdb .apt_generated artifacts **/dependency-reduced-pom.xml + +node +node_modules +build +package.json +package-lock.json diff --git a/docs/antora-playbook.yml b/docs/antora-playbook.yml index 9a70e676c..a68f5fe08 100644 --- a/docs/antora-playbook.yml +++ b/docs/antora-playbook.yml @@ -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: ./.. diff --git a/docs/antora.yml b/docs/antora.yml index 15b346da0..9b78762b4 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -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: diff --git a/docs/modules/ROOT/pages/_configprops.adoc b/docs/modules/ROOT/pages/_configprops.adoc deleted file mode 100644 index 040af820a..000000000 --- a/docs/modules/ROOT/pages/_configprops.adoc +++ /dev/null @@ -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} - -|=== diff --git a/docs/modules/ROOT/pages/configprops.adoc b/docs/modules/ROOT/pages/configprops.adoc new file mode 100644 index 000000000..32cbb8e58 --- /dev/null +++ b/docs/modules/ROOT/pages/configprops.adoc @@ -0,0 +1,6 @@ +[[configuration-properties]] += Configuration Properties + +Below you can find a list of configuration properties. + +include::partial$_configprops.adoc[] diff --git a/docs/modules/ROOT/pages/kafka/kafka-reactive.adoc b/docs/modules/ROOT/pages/kafka/kafka-reactive.adoc index 2a8e88cd3..1460fdc8b 100644 --- a/docs/modules/ROOT/pages/kafka/kafka-reactive.adoc +++ b/docs/modules/ROOT/pages/kafka/kafka-reactive.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> 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> 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>>> input() { .subscribe(); } ---- -==== Note that `reactor-kafka` returns a `Flux>>` 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 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> lowercase() return s -> s.map(rec -> new String(rec.value()).toLowerCase()); } ---- -==== In this function, note that, we are consuming the record as `Flux>` and then producing it as `Flux`. `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>`, 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 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. diff --git a/docs/modules/ROOT/pages/kafka/kafka_dlq.adoc b/docs/modules/ROOT/pages/kafka/kafka_dlq.adoc index 50e3dd197..ce954df60 100644 --- a/docs/modules/ROOT/pages/kafka/kafka_dlq.adoc +++ b/docs/modules/ROOT/pages/kafka/kafka_dlq.adoc @@ -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..`. 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. diff --git a/docs/modules/ROOT/pages/kafka/kafka_overview/rebalance-listener.adoc b/docs/modules/ROOT/pages/kafka/kafka_overview/rebalance-listener.adoc index ffc80c169..fa372ad77 100644 --- a/docs/modules/ROOT/pages/kafka/kafka_overview/rebalance-listener.adoc +++ b/docs/modules/ROOT/pages/kafka/kafka_overview/rebalance-listener.adoc @@ -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. diff --git a/docs/modules/ROOT/pages/kafka/kafka_overview/retry-and-dlq-processing.adoc b/docs/modules/ROOT/pages/kafka/kafka_overview/retry-and-dlq-processing.adoc index d493abb79..63c61c396 100644 --- a/docs/modules/ROOT/pages/kafka/kafka_overview/retry-and-dlq-processing.adoc +++ b/docs/modules/ROOT/pages/kafka/kafka_overview/retry-and-dlq-processing.adoc @@ -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 }; } ---- -==== diff --git a/docs/modules/ROOT/pages/kafka/kafka_overview/tombstones.adoc b/docs/modules/ROOT/pages/kafka/kafka_overview/tombstones.adoc index 63b7cb7e3..b9859c9ad 100644 --- a/docs/modules/ROOT/pages/kafka/kafka_overview/tombstones.adoc +++ b/docs/modules/ROOT/pages/kafka/kafka_overview/tombstones.adoc @@ -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, String> myFunction() { }; } ---- -==== diff --git a/docs/modules/ROOT/pages/kafka/kafka_overview/transactional-binder.adoc b/docs/modules/ROOT/pages/kafka/kafka_overview/transactional-binder.adoc index dbc760267..e549ae454 100644 --- a/docs/modules/ROOT/pages/kafka/kafka_overview/transactional-binder.adoc +++ b/docs/modules/ROOT/pages/kafka/kafka_overview/transactional-binder.adoc @@ -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`. diff --git a/docs/modules/ROOT/pages/pulsar/pulsar_binder.adoc b/docs/modules/ROOT/pages/pulsar/pulsar_binder.adoc index dc5e11b9a..cee7b3b12 100644 --- a/docs/modules/ROOT/pages/pulsar/pulsar_binder.adoc +++ b/docs/modules/ROOT/pages/pulsar/pulsar_binder.adoc @@ -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 ---- @@ -21,13 +24,15 @@ We need to include the following dependency on your application to use Apache Pu ---- +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`. diff --git a/docs/modules/ROOT/pages/rabbit/rabbit_overview/publisher-confirms.adoc b/docs/modules/ROOT/pages/rabbit/rabbit_overview/publisher-confirms.adoc index 29b8fe1bd..19f7142fb 100644 --- a/docs/modules/ROOT/pages/rabbit/rabbit_overview/publisher-confirms.adoc +++ b/docs/modules/ROOT/pages/rabbit/rabbit_overview/publisher-confirms.adoc @@ -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. diff --git a/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-consumer.adoc b/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-consumer.adoc index 86ce76dc6..a2281a9ca 100644 --- a/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-consumer.adoc +++ b/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-consumer.adoc @@ -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 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> 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 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. diff --git a/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-producer.adoc b/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-producer.adoc index 07d0a0739..5d6cc684f 100644 --- a/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-producer.adoc +++ b/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-producer.adoc @@ -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 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. diff --git a/docs/modules/ROOT/pages/rabbit/rabbit_overview/receiving-batch.adoc b/docs/modules/ROOT/pages/rabbit/rabbit_overview/receiving-batch.adoc index 6e03dca4e..46190e4a5 100644 --- a/docs/modules/ROOT/pages/rabbit/rabbit_overview/receiving-batch.adoc +++ b/docs/modules/ROOT/pages/rabbit/rabbit_overview/receiving-batch.adoc @@ -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>`; the headers are a `List>` 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 ---- -==== diff --git a/docs/modules/ROOT/pages/spring-cloud-stream/binding-properties.adoc b/docs/modules/ROOT/pages/spring-cloud-stream/binding-properties.adoc index e94915766..4b4ebf886 100644 --- a/docs/modules/ROOT/pages/spring-cloud-stream/binding-properties.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-stream/binding-properties.adoc @@ -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 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 { 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 diff --git a/docs/pom.xml b/docs/pom.xml index d9d7f6401..4a5a19eed 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -1,8 +1,9 @@ + 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"> 4.0.0 + org.springframework.cloud spring-cloud-stream-docs org.springframework.cloud @@ -10,14 +11,14 @@ 4.1.0-SNAPSHOT jar - spring-cloud-stream-docs - Spring Cloud Stream Core Documentation + Spring Cloud Stream Docs + Spring Cloud Stream Docs spring-cloud-stream ${basedir}/.. - 3.4 .*stream.* - deploy + + none @@ -41,50 +42,36 @@ docs + + + src/main/antora/resources/antora-resources + true + + pl.project13.maven git-commit-id-plugin + org.apache.maven.plugins maven-dependency-plugin - - maven-resources-plugin - org.codehaus.mojo exec-maven-plugin - org.asciidoctor - asciidoctor-maven-plugin + io.spring.maven.antora + antora-component-version-maven-plugin + io.spring.maven.antora + antora-maven-plugin + + + org.apache.maven.plugins maven-antrun-plugin - - - readme - prepare-package - - run - - - - - - - - - - - - - - - - maven-deploy-plugin diff --git a/docs/src/main/antora/resources/antora-resources/antora.yml b/docs/src/main/antora/resources/antora-resources/antora.yml new file mode 100644 index 000000000..9148923fa --- /dev/null +++ b/docs/src/main/antora/resources/antora-resources/antora.yml @@ -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@ diff --git a/docs/modules/ROOT/pages/README.adoc b/docs/src/main/asciidoc/README.adoc similarity index 94% rename from docs/modules/ROOT/pages/README.adoc rename to docs/src/main/asciidoc/README.adoc index 8c06a10ef..e648bdb08 100644 --- a/docs/modules/ROOT/pages/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -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 diff --git a/docs/modules/ROOT/pages/sagan-index.adoc b/docs/src/main/asciidoc/sagan-index.adoc similarity index 100% rename from docs/modules/ROOT/pages/sagan-index.adoc rename to docs/src/main/asciidoc/sagan-index.adoc