Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference Doc Improvements #2867

Conversation

NathanQingyangXu
Copy link
Contributor

some minor improvements to reference. See self-comments for the rationale behind the changes. Potentially more similar PRs will come in later

}
public void send(String toSend, int key) {
this.template.send("topic1", key, toSend);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we use 4 spaces in lieu of TAB in code snippets in reference. The above code uses TAB instead, ending up with ugly inconsitent indentation in the same code example:
Screenshot 2023-10-29 at 21 14 01

@@ -15,7 +15,7 @@ To close existing Consumers, call `stop()` (and then `start()`) on the `KafkaLis
For convenience, the framework also provides an `ABSwitchCluster` which supports two sets of bootstrap servers; one of which is active at any time.
Configure the `ABSwitchCluster` and add it to the producer and consumer factories, and the `KafkaAdmin`, by calling `setBootstrapServersSupplier()`.
When you want to switch, call `primary()` or `secondary()` and call `reset()` on the producer factory to establish new connection(s); for consumers, `stop()` and `start()` all listener containers.
When using `@KafkaListener` s, `stop()` and `start()` the `KafkaListenerEndpointRegistry` bean.
When using `@KafkaListener`+++s+++, `stop()` and `start()` the `KafkaListenerEndpointRegistry` bean.
Copy link
Contributor Author

@NathanQingyangXu NathanQingyangXu Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in AsciiDoc, `s will be rendered as
Screenshot 2023-10-29 at 21 17 19

that was why a space was inserted to avoid it. however, it looks weird:
Screenshot 2023-10-29 at 21 18 08

using +++ solves the issue:
Screenshot 2023-10-29 at 21 20 01

* `ProducerFactory` - see xref:kafka/sending-messages.adoc[Sending Messages]
* `ConsumerFactory` - see xref:kafka/receiving-messages.adoc[Receiving Messages]

Starting with version 2.5, each of these extends `KafkaResourceFactory`.
This allows changing the bootstrap servers at runtime by adding a `Supplier<String>` to their configuration: `setBootstrapServersSupplier(() -> ...)`.
This allows changing the bootstrap servers at runtime by adding a `Supplier<String>` to their configuration: `setBootstrapServersSupplier(() +++->+++ ...)`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> is special char in AsciiDoc, so we could use +++ to render it literally

.assignReplicas(2, Arrays.asList(2, 0))
.assignReplicas(0, List.of(0, 1))
.assignReplicas(1, List.of(1, 2))
.assignReplicas(2, List.of(2, 0))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary, but we have used Java 17, why not use the handy collection constant feature introduced since Java 9?

@NathanQingyangXu NathanQingyangXu force-pushed the feature/some-minor-improvement-reference branch from 4002fae to 0f60347 Compare October 30, 2023 01:32
@NathanQingyangXu NathanQingyangXu force-pushed the feature/some-minor-improvement-reference branch from 0f60347 to 59b0324 Compare October 30, 2023 01:34
@garyrussell garyrussell merged commit 0dfde15 into spring-projects:main Oct 30, 2023
2 checks passed
@garyrussell
Copy link
Contributor

Thanks!!

@garyrussell garyrussell changed the title some cosmetic improvements of the reference Reference Doc Improvements Oct 30, 2023
@garyrussell garyrussell added this to the 3.1.0 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants