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

Refactor template/producer to not use default topic name #25

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

onobc
Copy link
Collaborator

@onobc onobc commented Jul 11, 2022

This proposal does the following (reason in sub-bullets):

  • Introduces a PulsarOperations interface
    • matches spring-kafka and defines contract
    • provides default delegation methods to avoid cookie cutter code in impl
  • Removes producer caching from PulsarTemplate (will add this back in on follow commit but probably in producer factory)
    • Current caching is danger of OOME (no cleaning of cache)
  • Producer factory no longer holds onto a single producer instance
    • we hand out N of these, if anything we should hold reference to all and close etc..
  • Removes defaultClientName from PulsarTemplate
    • not thread-safe (topic set on producer config in producer factory)
    • misleading API and it mutates the config props (I never liked this about KafkaTemplate)

Fun facts

  • PulsarClient holds onto all Producers it spits out
  • PulsarClient closes all producers on its close
  • PulsarClient removes producer from list when producer is closed directly
  • Pulsar producers are bound to a single topic at creation time

@onobc onobc requested a review from sobychacko July 11, 2022 20:07
@onobc onobc merged commit 03425c5 into spring-projects:main Jul 12, 2022
@onobc onobc deleted the cbono-refactor-producer branch July 12, 2022 00:51
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.

1 participant