Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ If the topic is configured to use `LOG_APPEND_TIME`, the user-specified timestam
The `metrics` and `partitionsFor` methods delegate to the same methods on the underlying javadoc:org.apache.kafka.clients.producer.Producer[].
The `execute` method provides direct access to the underlying javadoc:org.apache.kafka.clients.producer.Producer[].

[NOTE]
====
When sending messages from Spring components, avoid using `@PostConstruct` methods
if you rely on automatic topic creation via `NewTopic` beans. `@PostConstruct` runs
before the application context is fully ready, which may cause
`UnknownTopicOrPartitionException` on clean brokers.
Copy link
Member

Choose a reason for hiding this comment

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

All good, but, please, consider to fix your change according to best practice rules we try to follow: https://asciidoctor.org/docs/asciidoc-recommended-practices/#one-sentence-per-line.

It also would be great to make the text as "personless".
Use the language which would not be like pointing to someone.
In other words try to avoid "you", "we", "they" etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for advice.
I revised documentation.


Instead, consider:
- Using an `ApplicationListener<ContextRefreshedEvent>` to send after the context is fully refreshed.
- Implementing `SmartLifecycle` and starting after `KafkaAdmin`.
- Or pre-creating topics externally.
====

To use the template, you can configure a producer factory and provide it in the template's constructor.
The following example shows how to do so:

Expand Down