### Console output when starting the application with RabbitMQ Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/preface.adoc Expected output when running the application's `main` method with RabbitMQ installed and running. It shows the framework declaring a queue for the inbound destination and starting the inbound adapter. ```bash --- [ main] c.s.b.r.p.RabbitExchangeQueueProvisioner : declaring queue for inbound: input.anonymous.CbMIwdkJSBO1ZoPDOtHtCg, bound to: input --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672] --- [ main] o.s.a.r.c.CachingConnectionFactory : Created new connection: rabbitConnectionFactory#2a3a299:0/SimpleConnection@66c83fc8. . . . . . --- [ main] o.s.i.a.i.AmqpInboundChannelAdapter : started inbound.input.anonymous.CbMIwdkJSBO1ZoPDOtHtCg . . . --- [ main] c.e.l.LoggingConsumerApplication : Started LoggingConsumerApplication in 2.531 seconds (JVM running for 2.897) ``` -------------------------------- ### Manually start processor via actuator REST endpoint Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/manually-starting-processors-selectively.adoc Curl command to POST a state change to `STARTED` for the `process3-in-0` binding. Requires Spring Boot actuator dependency on the classpath. ```bash curl -d '{"state":"STARTED"}' -H "Content-Type: application/json" -X POST http://localhost:8080/actuator/bindings/process3-in-0 ``` -------------------------------- ### META-INF/spring.binders file example Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/overview-binder-api.adoc Shows the format of the META-INF/spring.binders file, mapping a binder name to its configuration class. ```text kafka:\ org.springframework.cloud.stream.binder.kafka.config.KafkaBinderConfiguration ``` -------------------------------- ### Start brokers and Schema Registry Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/tools/kafka/docker-compose/README.adoc Starts the Kafka brokers and the Confluent Schema Registry (available at http://locahost:8081). The scripts must be chained together as the schema registry depends on the brokers. ```shell docker-compose -f ./kafka-cluster.yml -f ./schema-registry.yml up ``` -------------------------------- ### Register global state store using KafkaStreamsInfrastructureCustomizer Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/streamsbuilderfactorybean-customizer.adoc Use this configurer to register a global state store. The example uses KafkaStreamsInfrastructureCustomizer to add a global store to the StreamsBuilder. Avoid calling StreamsBuilderFactoryBean#getObject() to get the StreamsBuilder as it may cause circular dependency issues. ```java @Bean public StreamsBuilderFactoryBeanConfigurer customizer() { return streamsBuilderFactoryBean -> { try { streamsBuilderFactoryBean.setInfrastructureCustomizer(new KafkaStreamsInfrastructureCustomizer() { @Override public void configureBuilder(StreamsBuilder builder) { builder.addGlobalStore( ... ); } }); } catch (Exception e) { } }; } ``` -------------------------------- ### Implement ProvisioningProvider for file messaging Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/overview-custom-binder-impl.adoc Example ProvisioningProvider implementation that trims the destination name. It returns a FileMessageDestination for both producer and consumer destinations, and throws UnsupportedOperationException for partitioning. ```java public class FileMessageBinderProvisioner implements ProvisioningProvider { @Override public ProducerDestination provisionProducerDestination( final String name, final ProducerProperties properties) { return new FileMessageDestination(name); } @Override public ConsumerDestination provisionConsumerDestination( final String name, final String group, final ConsumerProperties properties) { return new FileMessageDestination(name); } private class FileMessageDestination implements ProducerDestination, ConsumerDestination { private final String destination; private FileMessageDestination(final String destination) { this.destination = destination; } @Override public String getName() { return destination.trim(); } @Override public String getNameForPartition(int partition) { throw new UnsupportedOperationException("Partitioning is not implemented for file messaging."); } } } ``` -------------------------------- ### Start cluster, UI, and Schema Registry Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/tools/kafka/docker-compose/README.adoc Starts the Kafka cluster, Control Center UI, and Schema Registry together by chaining all three compose files. ```shell docker-compose -f kafka-cluster.yml -f ./control-center-ui.yml -f ./schema-registry.yml up ``` -------------------------------- ### Start brokers and Control Center UI Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/tools/kafka/docker-compose/README.adoc Starts the Kafka brokers and the Confluent Control Center UI (available at http://locahost:9021). The scripts must be chained together as the UI depends on the brokers. ```shell docker-compose -f ./kafka-cluster.yml -f ./control-center-ui.yml up ``` -------------------------------- ### Get host info and query local or remote store Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/interactive-queries.adoc Use getHostInfo to determine which instance hosts a key, then query locally or remotely based on the current host. ```java org.apache.kafka.streams.state.HostInfo hostInfo = interactiveQueryService.getHostInfo("store-name", key, keySerializer); if (interactiveQueryService.getCurrentHostInfo().equals(hostInfo)) { //query from the store that is locally available } else { //query from the remote host } ``` -------------------------------- ### GET /{subject}/{format}/{version} Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/schema-registry/spring-cloud-stream-schema-registry.adoc Retrieves an existing schema by subject, format, and version. ```APIDOC ## GET /{subject}/{format}/{version} ### Description Retrieves an existing schema by subject, format, and version. ### Method GET ### Endpoint /{subject}/{format}/{version} ### Parameters #### Path Parameters - **subject** (string) - Required - The schema subject. - **format** (string) - Required - The schema format. - **version** (string) - Required - The schema version. ### Response #### Success Response (200) - **id** (string) - The schema ID. - **subject** (string) - The schema subject. - **format** (string) - The schema format. - **version** (string) - The schema version. - **definition** (string) - The schema definition. #### Response Example { "id": "string", "subject": "string", "format": "string", "version": "string", "definition": "string" } ``` -------------------------------- ### Start consumer-in-0 binding Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/binding-visualization-and-control-in-binder.adoc Start the consumer-in-0 binding again. When multiple bindings exist on a single function, invoking these operations on any of them works because they share the same StreamsBuilderFactoryBean. ```bash curl -d '{"state":"STARTED"}' -H "Content-Type: application/json" -X POST http://localhost:8080/actuator/bindings/consumer-in-0 ``` -------------------------------- ### Equivalent JAAS file for Spring Boot properties Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka_overview.adoc JAAS configuration file equivalent to the Spring Boot properties example. Uses Krb5LoginModule with keytab and principal. ```plaintext KafkaClient { com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab="/etc/security/keytabs/kafka_client.keytab" principal="kafka-client-1@EXAMPLE.COM"; }; ``` -------------------------------- ### Customize StreamsBuilderFactoryBean with state listener Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/streamsbuilderfactorybean-customizer.adoc Use this configurer to customize the StreamsBuilderFactoryBean before it is started. The example sets a state listener that is invoked on state changes. ```java @Bean public StreamsBuilderFactoryBeanConfigurer streamsBuilderFactoryBeanConfigurer() { return sfb -> sfb.setStateListener((newState, oldState) -> { //Do some action here! }); } ``` -------------------------------- ### BiConsumer bean with KStream and KTable Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka_tips.adoc Example of a BiConsumer bean that requires two input bindings: first for KStream, second for KTable. By default, both start from the earliest offset. ```java @Bean public BiConsumer, KTable> myBiConsumer{ (s, t) -> s.join(t, ...) ... } ``` -------------------------------- ### Download and run schema registry server Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/schema-registry/spring-cloud-stream-schema-registry.adoc Downloads and runs the standalone schema registry server version 4.0.3. The server is started as a standalone application using the downloaded JAR. ```bash wget https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-stream-schema-registry-server/4.0.3/spring-cloud-stream-schema-registry-server-4.0.3.jar java -jar ./spring-cloud-stream-schema-registry-server-4.0.3.jar ``` -------------------------------- ### Get binding details via actuator bindings endpoint Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/binding-visualization-and-control-in-binder.adoc Query the bindings endpoint to see details about all three bindings. The output shows the binding names, groups, and states. ```bash curl http://localhost:8080/actuator/bindings | jq . [ { "bindingName": "consumer-in-0", "name": "consumer-in-0", "group": "consumer-applicationId", "pausable": false, "state": "running", "paused": false, "input": true, "extendedInfo": {} }, { "bindingName": "function-in-0", "name": "function-in-0", "group": "function-applicationId", "pausable": false, "state": "running", "paused": false, "input": true, "extendedInfo": {} }, { "bindingName": "function-out-0", "name": "function-out-0", "group": "function-applicationId", "pausable": false, "state": "running", "paused": false, "input": false, "extendedInfo": {} } ] ``` -------------------------------- ### Start Kafka Streams processors manually with StreamsBuilderFactoryManager Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/manually-starting-processors.adoc Use this bean to start all Kafka Streams processors after disabling auto-startup via spring.kafka.streams.auto-startup=false. The ApplicationRunner calls sbfm.start() to start the processors separately from the main application startup. ```java @Bean public ApplicationRunner runner(StreamsBuilderFactoryManager sbfm) { return args -> { sbfm.start(); }; } ``` -------------------------------- ### Re-route DLQ messages for partitioned destinations with republishToDlq=false Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/rabbit/rabbit_dlq.adoc Spring Boot application for partitioned destinations where RabbitMQ publishes to DLX/DLQ with an x-death header. The example is incomplete in the source, showing only the class definition and constants. ```java @SpringBootApplication public class ReRouteDlqApplication { private static final String ORIGINAL_QUEUE = "so8400in.so8400"; private static final String DLQ = ORIGINAL_QUEUE + ".dlq"; private static final String PARKING_LOT = ORIGINAL_QUEUE + ".parkingLot"; private static final String X_DEATH_HEADER = "x-death"; ``` -------------------------------- ### GET /actuator/bindings Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Visualizes all current bindings. Returns a list of binding states. ```APIDOC ## GET /actuator/bindings ### Description Visualizes all current bindings. Returns a list of binding states. ### Method GET ### Endpoint /actuator/bindings ### Response Returns a list of binding states. ### Example ``` http://:/actuator/bindings ``` ``` -------------------------------- ### Manually start processor using BindingsEndpoint API Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/manually-starting-processors-selectively.adoc Java code that autowires `BindingsEndpoint` and uses an `ApplicationRunner` to call `changeState` with `State.STARTED` for the `process3-in-0` binding. Requires Spring Boot actuator dependency. ```java @Autowired BindingsEndpoint endpoint; @Bean public ApplicationRunner runner() { return args -> { endpoint.changeState("process3-in-0", State.STARTED); }; } ``` -------------------------------- ### ReRouteDlqApplication with republishToDlq=true headers Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/rabbit/rabbit_dlq.adoc This example shows a Spring Boot application that listens to a DLQ and republishes failed messages up to 3 times using the original exchange and routing key headers added by the republishing recoverer when republishToDlq=true. After exceeding retries, it sends the message to a parking lot queue. The main method runs the application and waits for user input to exit. ```java @SpringBootApplication public class ReRouteDlqApplication { private static final String ORIGINAL_QUEUE = "so8400in.so8400"; private static final String DLQ = ORIGINAL_QUEUE + ".dlq"; private static final String PARKING_LOT = ORIGINAL_QUEUE + ".parkingLot"; private static final String X_ORIGINAL_EXCHANGE_HEADER = RepublishMessageRecoverer.X_ORIGINAL_EXCHANGE; private static final String X_ORIGINAL_ROUTING_KEY_HEADER = RepublishMessageRecoverer.X_ORIGINAL_ROUTING_KEY; public static void main(String[] args) throws Exception { ConfigurableApplicationContext context = SpringApplication.run(ReRouteDlqApplication.class, args); System.out.println("Press enter to exit"); System.in.read(); context.close(); } @Autowired private RabbitTemplate rabbitTemplate; @RabbitListener(queues = DLQ) public void rePublish(Message failedMessage) { Map headers = failedMessage.getMessageProperties().getHeaders(); long retries = failedMessage.getMessageProperties().getRetryCount(); if (retries < 3) { failedMessage.getMessageProperties().incrementRetryCount(); String exchange = (String) headers.get(X_ORIGINAL_EXCHANGE_HEADER); String originalRoutingKey = (String) headers.get(X_ORIGINAL_ROUTING_KEY_HEADER); this.rabbitTemplate.send(exchange, originalRoutingKey, failedMessage); } else { this.rabbitTemplate.send(PARKING_LOT, failedMessage); } } @Bean public Queue parkingLot() { return new Queue(PARKING_LOT); } } ``` -------------------------------- ### GET /subject/format Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/schema-registry/spring-cloud-stream-schema-registry.adoc Retrieves existing schemas by subject and format. ```APIDOC ## GET /subject/format ### Description Retrieves existing schemas by subject and format. ### Method GET ### Endpoint /subject/format ### Parameters #### Path Parameters - **subject** (string) - Required - The schema subject. - **format** (string) - Required - The schema format. ### Response #### Success Response (200) A list of schema objects, each with the following fields: - **id** (string) - The schema ID. - **subject** (string) - The schema subject. - **format** (string) - The schema format. - **version** (string) - The schema version. - **definition** (string) - The schema definition. #### Response Example [ { "id": "string", "subject": "string", "format": "string", "version": "string", "definition": "string" } ] ``` -------------------------------- ### Start Kafka cluster with Zookeeper Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/tools/kafka/docker-compose/README.adoc Starts a multi-node Kafka cluster with 3 brokers at localhost:9091,9092,9093 using Zookeeper for leader election. Run from the tools/kafka/docker-compose directory. ```shell docker-compose -f ./kafka-cluster.yml up ``` -------------------------------- ### Set startOffset to latest for Kafka Streams bindings Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka_tips.adoc Configure both bindings of a BiConsumer to start from the latest offset. If only one binding should start from latest, leave the other out. Once committed offsets exist, these settings are not honored. ```properties spring.cloud.stream.kafka.streams.bindings.myBiConsumer-in-0.consumer.startOffset: latest spring.cloud.stream.kafka.streams.bindings.myBiConsumer-in-1.consumer.startOffset: latest ``` -------------------------------- ### ReRouteDlqApplication with x-death header republishing Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/rabbit/rabbit_dlq.adoc This example shows a Spring Boot application that listens to a DLQ and republishes failed messages up to 3 times using the x-death header to extract the original exchange and routing key. After exceeding retries, it sends the message to a parking lot queue. The main method runs the application and waits for user input to exit. ```java public static void main(String[] args) throws Exception { ConfigurableApplicationContext context = SpringApplication.run(ReRouteDlqApplication.class, args); System.out.println("Press enter to exit"); System.in.read(); context.close(); } @Autowired private RabbitTemplate rabbitTemplate; @SuppressWarnings("unchecked") @RabbitListener(queues = DLQ) public void rePublish(Message failedMessage) { Map headers = failedMessage.getMessageProperties().getHeaders(); long retries = failedMessage.getMessageProperties().getRetryCount(); if (retries < 3) { failedMessage.getMessageProperties().incrementRetryCount(); List> xDeath = (List>) headers.get(X_DEATH_HEADER); String exchange = (String) xDeath.get(0).get("exchange"); List routingKeys = (List) xDeath.get(0).get("routing-keys"); this.rabbitTemplate.send(exchange, routingKeys.get(0), failedMessage); } else { this.rabbitTemplate.send(PARKING_LOT, failedMessage); } } @Bean public Queue parkingLot() { return new Queue(PARKING_LOT); } } ``` -------------------------------- ### StreamBridge dynamic destination example with ApplicationRunner Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/producing-and-consuming-messages.adoc Shows using StreamBridge to send to a dynamic destination 'myDestination' that does not exist as a binding. The destination is created automatically and cached. This example uses an ApplicationRunner as a foreign source. ```java @SpringBootApplication @Controller public class WebSourceApplication { public static void main(String[] args) { SpringApplication.run(WebSourceApplication.class, args); } @Autowired private StreamBridge streamBridge; @RequestMapping @ResponseStatus(HttpStatus.ACCEPTED) public void delegateToSupplier(@RequestBody String body) { System.out.println("Sending " + body); streamBridge.send("myDestination", body); } } ``` -------------------------------- ### Define three Kafka Streams processors (process1, process2, process3) Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/manually-starting-processors-selectively.adoc Example of three function beans: a `Function`, a `Consumer`, and a `BiFunction`. The `BiFunction` has two input bindings (`process3-in-0` and `process3-in-1`). This is the context for selectively disabling auto-start on one processor. ```java @Bean public Function, KStream> process1() { } @Bean public Consumer> process2() { } @Bean public BiFunction, KTable, KStream> process3() { } ``` -------------------------------- ### Example message handler function Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/mechanics.adoc A simple Function handler that expects a Person and returns a String. Used to illustrate content-type negotiation. ```java public Function personFunction {..} ``` -------------------------------- ### Customize KafkaStreams with uncaught exception handler Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/streamsbuilderfactorybean-customizer.adoc Use this configurer to customize the underlying KafkaStreams object. The example sets an uncaught exception handler. ```java @Bean public StreamsBuilderFactoryBeanConfigurer streamsBuilderFactoryBeanConfigurer() { return factoryBean -> { factoryBean.setKafkaStreamsCustomizer(new KafkaStreamsCustomizer() { @Override public void customize(KafkaStreams kafkaStreams) { kafkaStreams.setUncaughtExceptionHandler((t, e) -> { }); } }); }; } ``` -------------------------------- ### Define AdminClientConfigCustomizer bean Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-binder/admin-client-config-cust.adoc Provides a bean that customizes admin client properties. The configure method receives a Properties object, and the example sets the security protocol to SASL_SSL. ```java @Bean public AdminClientConfigCustomizer adminClientConfigCustomizer() { return props -> { props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_SSL"); }; } ``` -------------------------------- ### GET /actuator/bindings/{name} Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Visualizes a single binding by name. Returns the state of the specified binding. ```APIDOC ## GET /actuator/bindings/{name} ### Description Visualizes a single binding by name. Returns the state of the specified binding. ### Method GET ### Endpoint /actuator/bindings/{name} ### Parameters #### Path Parameters - **name** (String) - Required - The name of the binding. ### Response Returns the state of the specified binding. ### Example ``` http://:/actuator/bindings/ ``` ``` -------------------------------- ### input function using Flux>> with reactiveAutoCommit Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-reactive-binder/examples.adoc A consumer that handles the native ConsumerRecord flux returned by reactor-kafka when reactiveAutoCommit is enabled. No message conversion is applied, so native decoding via Deserializer configuration is required. ```java @Bean Consumer>>> input() { return flux -> flux .doOnNext(inner -> inner .doOnNext(val -> { log.info(val.value()); }) .subscribe()) .subscribe(); } ``` -------------------------------- ### GET /{subject}/{format}/{version} Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/schema-registry/spring-cloud-stream-schema-registry.adoc Retrieves an existing schema by subject, format, and version. The response contains the schema object including its ID, subject, format, version, and definition. ```APIDOC ## GET /{subject}/{format}/{version} ### Description Retrieves an existing schema by subject, format, and version. ### Method GET ### Endpoint /{subject}/{format}/{version} ### Parameters #### Path Parameters - **subject** (string) - Required - The schema subject - **format** (string) - Required - The schema format - **version** (integer) - Required - The schema version ### Response #### Success Response (200) - **id** (integer) - The schema ID - **subject** (string) - The schema subject - **format** (string) - The schema format - **version** (integer) - The schema version - **definition** (string) - The schema definition #### Response Example { "id": 1, "subject": "foo", "format": "avro", "version": 1, "definition": "{\"type\":\"record\",\"name\":\"Foo\",\"fields\":[]}" } ``` -------------------------------- ### uppercase function using Flux Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-reactive-binder/examples.adoc A basic reactive function that maps each string to uppercase. Works with both the regular Kafka binder and the reactive Kafka binder, but only the reactive binder provides end-to-end reactive benefits. ```java @Bean public Function, Flux> uppercase() { return s -> s.map(String::toUpperCase); } ``` -------------------------------- ### GET /{subject}/{format} Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/schema-registry/spring-cloud-stream-schema-registry.adoc Retrieves an existing schema by subject and format. The response contains the schema object including its ID, subject, format, version, and definition. ```APIDOC ## GET /{subject}/{format} ### Description Retrieves an existing schema by subject and format. ### Method GET ### Endpoint /{subject}/{format} ### Parameters #### Path Parameters - **subject** (string) - Required - The schema subject - **format** (string) - Required - The schema format ### Response #### Success Response (200) - **id** (integer) - The schema ID - **subject** (string) - The schema subject - **format** (string) - The schema format - **version** (integer) - The schema version - **definition** (string) - The schema definition #### Response Example { "id": 1, "subject": "foo", "format": "avro", "version": 1, "definition": "{\"type\":\"record\",\"name\":\"Foo\",\"fields\":[]}" } ``` -------------------------------- ### Define new input binding with createInputBinding Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Create a new input binding using BindingsLifecycleController.createInputBinding. Requires a DefaultBinderFactory bean and binder instance. The example sets destination, group, and consumer properties for a Rabbit binder. ```java DefaultBinderFactory binderFactory = context.getBean(DefaultBinderFactory.class); Object binder = binderFactory.getBinder("rabbit", MessageChannel.class); String inputName = "test-output-binding"; BindingsLifecycleController controller = context.getBean(BindingsLifecycleController.class); BindingProperties bindingProperties = new BindingProperties(); bindingProperties.setDestination("myDest"); bindingProperties.setGroup("myGroup"); // must define group for input binding ConsumerProperties consumerProperties = new ConsumerProperties(); bindingProperties.setConsumer(consumerProperties); RabbitConsumerProperties extendedConsumerProperties = controller.createInputBinding(inputName, "rabbit", bindingProperties); ``` -------------------------------- ### Get extension properties with getExtensionProperties Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Retrieve the extension properties for a binding using BindingsLifecycleController.getExtensionProperties. The example casts to KafkaConsumerProperties, but the actual type depends on the binder and binding used. ```java KafkaConsumerProperties properties = controller.getExtensionProperties("test-input-binding”); ``` -------------------------------- ### Access state store in Processor Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/state-store.adoc Shows how to retrieve a WindowStore from the processor context during init. Note: this approach does not work for global state stores. ```java Processor() { WindowStore state; @Override public void init(ProcessorContext processorContext) { state = (WindowStore)processorContext.getStateStore("mystate"); } ... } ``` -------------------------------- ### Use DltAwareProcessor to publish failed records to a DLT Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/error-handling.adoc This example shows how to use DltAwareProcessor inside a KStream#process call. The constructor takes a Function (business logic), the DLT topic name, and a DltPublishingContext. When the Function throws an exception, the record is sent to the DLT. ```java @Bean public java.util.function.Function, KStream> process(DltPublishingContext dltSenderContext) { return input -> input .process(() -> new DltAwareProcessor<>(record -> { throw new RuntimeException("error"); }, "hello-dlt-1", dltPublishingContext)); } ``` -------------------------------- ### Seek to arbitrary offsets on partition assignment Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka_tips.adoc Implement onPartitionsAssigned to seek to specific offsets for each partition when the consumer is initially assigned. The example uses a map of partition-to-offset and only seeks when the 'initial' flag is true, avoiding re-seeks during rebalances. Handle exceptions carefully as seek may throw runtime exceptions. ```java @Override public void onPartitionsAssigned(String bindingName, Consumer consumer, Collection partitions, boolean initial) { Map topicPartitionOffset = new HashMap<>(); topicPartitionOffset.put(new TopicPartition("foo", 0), 1000L); topicPartitionOffset.put(new TopicPartition("foo", 1), 2000L); topicPartitionOffset.put(new TopicPartition("foo", 2), 2000L); topicPartitionOffset.put(new TopicPartition("foo", 3), 1000L); if (initial) { partitions.forEach(tp -> { if (topicPartitionOffset.containsKey(tp)) { final Long offset = topicPartitionOffset.get(tp); try { consumer.seek(tp, offset); } catch (Exception e) { // Handle exceptions carefully. } } }); } } ``` -------------------------------- ### Define a BinderCustomizer bean to customize binders by type Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binder-customizer.adoc Provides a BinderCustomizer bean that checks the binder type and applies customizations. Use this in multi-binder applications where binders reside in different application contexts. The customizations are applied before the application starts using the binders. When there are multiple binders of the same type, use the binder name to filter customization. ```java @Bean public BinderCustomizer binderCustomizer() { return (binder, binderName) -> { if (binder instanceof KafkaMessageChannelBinder kafkaMessageChannelBinder) { kafkaMessageChannelBinder.setRebalanceListener(...); } else if (binder instanceof KStreamBinder) { ... } else if (binder instanceof RabbitMessageChannelBinder) { ... } }; } ``` -------------------------------- ### Super Stream consumer configuration Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/rabbit/rabbit_overview/rabbitmq-stream-consumer.adoc Configuration example for a super stream consumer. The Java bean defines a Consumer and the properties configure the destination, group, instance count, concurrency, container type, and super-stream flag. ```java @Bean public Consumer input() { ... } ``` ```properties spring.cloud.stream.bindings.input-in-0.destination=super spring.cloud.stream.bindings.input-in-0.group=test spring.cloud.stream.bindings.input-in-0.consumer.instance-count=3 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 ``` -------------------------------- ### Control binding lifecycle with BindingsLifecycleController Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Retrieve the BindingsLifecycleController bean and use queryState and changeState to control the lifecycle of a binding. The example stops the 'echo-in-0' binding and asserts it is no longer running. ```java BindingsLifecycleController bindingsController = context.getBean(BindingsLifecycleController.class); Binding binding = bindingsController.queryState("echo-in-0"); assertThat(binding.isRunning()).isTrue(); bindingsController.changeState("echo-in-0", State.STOPPED); //Alternative way of changing state. For convenience we expose start/stop and pause/resume operations. //bindingsController.stop("echo-in-0") assertThat(binding.isRunning()).isFalse(); ``` -------------------------------- ### Custom ListenerContainerWithDlqAndRetryCustomizer bean Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-binder/retry-dlq.adoc Example customizer that moves retry and DLQ handling to the container for a specific topic. It configures a DeadLetterPublishingRecoverer and DefaultErrorHandler with the provided backOff, and disables binding-level retry/DLQ for topics containing 'topicWithLongTotalRetryConfig'. ```java @Bean ListenerContainerWithDlqAndRetryCustomizer cust(KafkaTemplate template) { return new ListenerContainerWithDlqAndRetryCustomizer() { @Override public void configure(AbstractMessageListenerContainer container, String destinationName, String group, @Nullable BiFunction, Exception, TopicPartition> dlqDestinationResolver, @Nullable BackOff backOff) { if (destinationName.equals("topicWithLongTotalRetryConfig")) { ConsumerRecordRecoverer dlpr = new DeadLetterPublishingRecoverer(template, dlqDestinationResolver); container.setCommonErrorHandler(new DefaultErrorHandler(dlpr, backOff)); } } @Override public boolean retryAndDlqInBinding(String destinationName, String group) { return !destinationName.contains("topicWithLongTotalRetryConfig"); } }; } ``` -------------------------------- ### Configure application.server property Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/interactive-queries.adoc Set the application.server configuration property to enable host information lookup for interactive queries in multi-instance deployments. ```properties spring.cloud.stream.kafka.streams.binder.configuration.application.server: : ``` -------------------------------- ### Advanced Consumer Configuration with ListenerContainerCustomizer and MessageSourceCustomizer Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding-properties.adoc Add these beans to customize the underlying message listener container for message-driven consumers and polled consumers. The containerCustomizer is invoked after standard properties are applied; sourceCustomizer is for polled consumers. Example shown for RabbitMQ binder. ```java @Bean public ListenerContainerCustomizer containerCustomizer() { return (container, dest, group) -> container.setAdviceChain(advice1, advice2); } @Bean public MessageSourceCustomizer sourceCustomizer() { return (source, dest, group) -> source.setPropertiesConverter(customPropertiesConverter); } ``` -------------------------------- ### Function bean for binding name example Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding-properties.adoc Example of a Spring Cloud Stream function bean that creates two bindings: `uppercase-in-0` for input and `uppercase-out-0` for output. ```java @Bean public Function uppercase() { return v -> v.toUpperCase(); } ``` -------------------------------- ### consume function with KafkaHeaders.ACKNOWLEDGMENT and ReceiverOffset Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-reactive-binder/examples.adoc A consumer that processes a message and manually acknowledges the offset using the ReceiverOffset from the KafkaHeaders.ACKNOWLEDGMENT header. The binder does not commit offsets by default, so this is required for manual offset management. ```java @Bean public Consumer>> consume() { return msg -> { process(msg.getPayload()); msg.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT, ReceiverOffset.class).acknowledge(); } } ``` -------------------------------- ### Kafka Streams application with consumer and function beans Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/binding-visualization-and-control-in-binder.adoc Example application with two Kafka Streams functions: a consumer and a function. The consumer binding is named consumer-in-0, and the function has input binding function-in-0 and output binding function-out-0. ```java @SpringBootApplication public class KafkaStreamsApplication { public static void main(String[] args) { SpringApplication.run(KafkaStreamsApplication.class, args); } @Bean public Consumer> consumer() { return s -> s.foreach((key, value) -> System.out.println(value)); } @Bean public Function, KStream> function() { return ks -> ks; } } ``` -------------------------------- ### Implement MessageProducer for file polling Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/overview-custom-binder-impl.adoc Example MessageProducer that extends MessageProducerSupport to poll a file every 50 milliseconds, send new messages, and archive read messages. It discards identical consecutive payloads and throws RuntimeException on I/O errors. ```java public class FileMessageProducer extends MessageProducerSupport { public static final String ARCHIVE = "archive.txt"; private final ConsumerDestination destination; private String previousPayload; public FileMessageProducer(ConsumerDestination destination) { this.destination = destination; } @Override public void doStart() { receive(); } private void receive() { ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); executorService.scheduleWithFixedDelay(() -> { String payload = getPayload(); if(payload != null) { Message receivedMessage = MessageBuilder.withPayload(payload).build(); archiveMessage(payload); sendMessage(receivedMessage); } }, 0, 50, MILLISECONDS); } private String getPayload() { try { List allLines = Files.readAllLines(Paths.get(destination.getName())); String currentPayload = allLines.get(allLines.size() - 1); if(!currentPayload.equals(previousPayload)) { previousPayload = currentPayload; return currentPayload; } } catch (IOException e) { throw new RuntimeException(e); } return null; } private void archiveMessage(String payload) { try { Files.write(Paths.get(ARCHIVE), (payload + "\n").getBytes(), CREATE, APPEND); } catch (IOException e) { throw new RuntimeException(e); } } } ``` -------------------------------- ### Consumer with observability using KafkaReceiverObservation Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-reactive-binder/reactive_observability.adoc Creates a `Consumer` bean that receives a `Flux>`. Since there's no output binding, `doOnNext` is used on the `Flux` instead of `flatMap`. The direct call to `observe` starts the observation and properly shuts it down when finished. ```java @Bean Consumer>> receive(ObservationRegistry observationRegistry, @Value("${spring.kafka.bootstrap-servers}") String bootstrap) { return f -> f.doOnNext(record -> KafkaReceiverObservation.RECEIVER_OBSERVATION.observation( null, KafkaReceiverObservation.DefaultKafkaReceiverObservationConvention.INSTANCE, () -> new KafkaRecordReceiverContext(record, "user.receiver", bootstrap), observationRegistry).observe(() -> System.out.println(record))) .subscribe(); } ``` -------------------------------- ### Configure publisher confirms with useConfirmHeader Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/rabbit/rabbit_overview/publisher-confirms.adoc Properties configuration for enabling publisher confirms using the correlation header. Requires setting spring.rabbitmq.publisher-confirm-type=correlated and spring.rabbitmq.publisher-returns=true. Also enables batch mode, error channel, and DLQ. ```properties spring.cloud.stream.bindings.input-in-0.group=someGroup spring.cloud.stream.bindings.input-in-0.consumer.batch-mode=true spring.cloud.stream.source=output spring.cloud.stream.bindings.output-out-0.producer.error-channel-enabled=true spring.cloud.stream.rabbit.bindings.output-out-0.producer.useConfirmHeader=true spring.cloud.stream.rabbit.bindings.input-in-0.consumer.auto-bind-dlq=true spring.cloud.stream.rabbit.bindings.input-in-0.consumer.batch-size=10 spring.rabbitmq.publisher-confirm-type=correlated spring.rabbitmq.publisher-returns=true ``` -------------------------------- ### Configure output binding with partitionKeyExpression and partitionCount Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/overview-partitioning.adoc Configures an output binding to partition data by setting partitionKeyExpression (a SpEL expression evaluated against the outbound message, here extracting the 'id' header) and partitionCount. This is a valid and typical configuration for partitioned output. ```properties spring.cloud.stream.bindings.func-out-0.producer.partitionKeyExpression=headers.id spring.cloud.stream.bindings.func-out-0.producer.partitionCount=5 ``` -------------------------------- ### Control Binding State with curl POST Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Use these curl commands to stop, start, pause, or resume a binding by posting a JSON state to the actuator endpoint. Replace , , and myBindingName with actual values. PAUSED and RESUMED only work if the binder supports them; otherwise a warning is logged. Currently only Kafka and Solace binders support PAUSED and RESUMED. ```bash curl -d '{"state":"STOPPED"}' -H "Content-Type: application/json" -X POST http://:/actuator/bindings/myBindingName ``` ```bash curl -d '{"state":"STARTED"}' -H "Content-Type: application/json" -X POST http://:/actuator/bindings/myBindingName ``` ```bash curl -d '{"state":"PAUSED"}' -H "Content-Type: application/json" -X POST http://:/actuator/bindings/myBindingName ``` ```bash curl -d '{"state":"RESUMED"}' -H "Content-Type: application/json" -X POST http://:/actuator/bindings/myBindingName ``` -------------------------------- ### Add Spring Boot Web dependency Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Add the spring-boot-starter-web dependency to enable web support, required for actuator endpoints. ```xml org.springframework.boot spring-boot-starter-web ``` -------------------------------- ### Kafka Streams binder configuration property example Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/configuration-options.adoc Example of setting Kafka Streams configuration properties at the binder level using the `spring.cloud.stream.kafka.streams.binder.configuration` property. These properties apply to the entire application and all processors. ```properties spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000 ``` -------------------------------- ### Configure input binding for partitioning Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/overview-partitioning.adoc Configures an input binding to receive partitioned data. Sets the consumer 'partitioned' property to true and specifies the instance index and count. The instanceIndex must be unique and between 0 and instanceCount-1. ```properties spring.cloud.stream.bindings.uppercase-in-0.consumer.partitioned=true spring.cloud.stream.instanceIndex=3 spring.cloud.stream.instanceCount=5 ``` -------------------------------- ### GET /schemas/{id} Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/schema-registry/spring-cloud-stream-schema-registry.adoc Retrieves a schema by its ID. ```APIDOC ## GET /schemas/{id} ### Description Retrieves a schema by its ID. ### Method GET ### Endpoint /schemas/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The schema ID. ### Response #### Success Response (200) - **id** (string) - The schema ID. - **subject** (string) - The schema subject. - **format** (string) - The schema format. - **version** (string) - The schema version. - **definition** (string) - The schema definition. #### Response Example { "id": "string", "subject": "string", "format": "string", "version": "string", "definition": "string" } ``` -------------------------------- ### Custom MessageRoutingCallback example Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/event-routing.adoc Register a `MessageRoutingCallback` bean to implement complex routing logic. It takes precedence over all other routing mechanisms. The example routes messages to `evenHandler` or `oddHandler` based on the payload's parity. ```java @SpringBootApplication public class SampleApplication { public static void main(String[] args) { SpringApplication.run(SampleApplication.class, "--spring.cloud.stream.function.routing.enabled=true"); } @Bean public MessageRoutingCallback customRouter() { return message -> { Integer payload = (Integer) message.getPayload(); return payload % 2 == 0 ? "evenHandler" : "oddHandler"; }; } @Bean public Consumer evenHandler() { return value -> System.out.println("EVEN: " + value); } @Bean public Consumer oddHandler() { return value -> System.out.println("ODD: " + value); } } ``` -------------------------------- ### Disable auto-startup for process3 via consumer binding (process3-in-1) Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/manually-starting-processors-selectively.adoc Alternative property to set `auto-startup` to `false` on the `process3-in-1` consumer binding. Either binding is sufficient; setting both is optional for clarity. ```properties spring.cloud.stream.bindings.process3-in-1.consumer.auto-startup: false ``` -------------------------------- ### POST /actuator/bindings/{bindingName} Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/binding_visualization_control.adoc Stops, starts, pauses, or resumes an individual binding by posting a state argument as JSON to the binding actuator endpoint. The state can be STOPPED, STARTED, PAUSED, or RESUMED, with PAUSED and RESUMED supported only by certain binders like Kafka and Solace. ```APIDOC ## [POST] /actuator/bindings/{bindingName} ### Description Stops, starts, pauses, or resumes an individual binding by posting a state argument as JSON to the binding actuator endpoint. The state can be STOPPED, STARTED, PAUSED, or RESUMED, with PAUSED and RESUMED supported only by certain binders like Kafka and Solace. ### Method POST ### Endpoint http://:/actuator/bindings/{bindingName} ### Parameters #### Path Parameters - **bindingName** (string) - Required - The name of the binding to control. #### Request Body - **state** (string) - Required - The desired state: STOPPED, STARTED, PAUSED, or RESUMED. ### Request Example ```json {"state":"STOPPED"} ``` ### Response #### Success Response (200) No response body is documented. ### Error Handling - PAUSED and RESUMED are only supported by Kafka and Solace binders; otherwise, a warning message is logged. ``` -------------------------------- ### Per-binding binder configuration Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/multiple-binders.adoc Configures individual bindings to use specific binders. Here, the input binding uses Kafka and the output binding uses RabbitMQ, overriding the default binder. ```properties spring.cloud.stream.bindings.input.binder=kafka spring.cloud.stream.bindings.output.binder=rabbit ``` -------------------------------- ### Get KeyQueryMetadata method signature Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/interactive-queries.adoc Method signature for retrieving KeyQueryMetadata for a given store and key. ```java public KeyQueryMetadata getKeyQueryMetadata(String store, K key, Serializer serializer) ``` -------------------------------- ### Activate a profile for a binder environment Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/multiple-systems.adoc Shows how to activate a specific Spring profile for a particular binder environment using the spring.profiles.active property. ```yaml environment: spring: profiles: active: myBinderProfile ``` -------------------------------- ### Get KafkaStreams method signature Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/interactive-queries.adoc Method signature for retrieving the KafkaStreams object associated with a store and key. ```java public KafkaStreams getKafkaStreams(String store, K key, Serializer serializer) ``` -------------------------------- ### Processor function that returns KStream Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/kafka/kafka-streams-binder/partition-support-on-the-outbound.adoc The processor function that processes input and returns a KStream. This is the same processor used in other examples. ```java @Bean public Function, KStream> process() { ... } ``` -------------------------------- ### Implement FileMessageBinder by extending AbstractMessageChannelBinder Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/docs/modules/ROOT/pages/spring-cloud-stream/overview-custom-binder-impl.adoc Extend AbstractMessageChannelBinder to implement a custom binder. Override createProducerMessageHandler to write messages to a file and createConsumerEndpoint to return a FileMessageProducer. The generic argument specifies the ProvisioningProvider. ```java public class FileMessageBinder extends AbstractMessageChannelBinder { public FileMessageBinder( String[] headersToEmbed, FileMessageBinderProvisioner provisioningProvider) { super(headersToEmbed, provisioningProvider); } @Override protected MessageHandler createProducerMessageHandler( final ProducerDestination destination, final ProducerProperties producerProperties, final MessageChannel errorChannel) throws Exception { return message -> { String fileName = destination.getName(); String payload = new String((byte[])message.getPayload()) + "\n"; try { Files.write(Paths.get(fileName), payload.getBytes(), CREATE, APPEND); } catch (IOException e) { throw new RuntimeException(e); } }; } @Override protected MessageProducer createConsumerEndpoint( final ConsumerDestination destination, final String group, final ConsumerProperties properties) throws Exception { return new FileMessageProducer(destination); } } ``` -------------------------------- ### Stop brokers and Schema Registry Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/tools/kafka/docker-compose/README.adoc Stops the Kafka brokers and the Confluent Schema Registry started with the chained command. ```shell docker-compose -f ./kafka-cluster.yml -f ./schema-registry.yml down ``` -------------------------------- ### Stop Kafka cluster with Zookeeper Source: https://github.com/spring-cloud/spring-cloud-stream/blob/main/tools/kafka/docker-compose/README.adoc Stops the multi-node Kafka cluster started with kafka-cluster.yml. Use CTRL-C if running in foreground. ```shell docker-compose -f ./kafka-cluster.yml down ```