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

README: improve KafkaProducer examples #76

Conversation

felixschlegel
Copy link
Contributor

@felixschlegel felixschlegel commented Jun 28, 2023

Note: this PR sits upon #67

Modifications:

  • README:
    • add example for KafkaProducer without acknowledgements
    • remove KafkaProducer.shutdownGracefully invocation for

Motiviation:

* align `KafkaProducer` more with proposed changes to `KafkaConsumer`
* `AsyncStream` was not handling `AsyncSequence` termination handling as
  we wanted it to, so revert back to use `NIOAsyncSequenceProducer`

Modifications:

* make `KafkaProducer` `final class` instead of `actor`
* `KafkaProducer`: use `NIOAsyncSequenceProducer` instead of
  `AsyncSequence` for better termination handling -> shutdown
  `KafkaProducer` on termination of the `AsyncSequence`
* introduce `StateMachine` to `KafkaProducer`
* move internal state of `KafkaProducer` to `KafkaProducer.StateMachine`
* remove unused `await` expressions when accessing `KafkaProducer`
* update tests
* update `README`
Modifications:

* `README`:
    * add example for `KafkaProducer` without acknowledgements
    * remove `KafkaProducer.shutdownGracefully` invocation for
      acknowledgement producer

let producer = try KafkaProducer.makeProducer(
config: config,
logger: .kafkaTest // Your logger here
Copy link
Contributor

Choose a reason for hiding this comment

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

We normally just do this

Suggested change
logger: .kafkaTest // Your logger here
logger: logger

Comment on lines +54 to +55
// Required
await producer.shutdownGracefully()
Copy link
Contributor

Choose a reason for hiding this comment

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

We really want to get rid of this by folding it into the run() method. Maybe let's not add this to the example here.

@FranzBusch FranzBusch closed this Aug 10, 2023
@FranzBusch FranzBusch deleted the fs-readme-fix-producer-example branch August 10, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants