Add support for producing messages using @PulsarProducer
- Dominant language
- Kotlin
- Stars
- 13
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
In order to publish messages users has to create a producer template, as shown in below code. Register this producer template as a spring bean , autowire it into any spring component and the use send() or sendAsync method to publish message.
```
@Configuration
open class ProducerConfiguration(val applicationContext: ApplicationContext) {
@Bean
open fun producerTemplate(): PulsarProducerTemplate {
return PulsarProducerTemplateImpl(
pulsarProducerConfig = PulsarProducerConfig(
schema = Schema.BYTES,
topicName = "persistent://tenent/namespace/topicName",
autoFlush = true),
applicationContext = applicationContext)
}
}
```
This is slightly cumbersome for basic and simple usecases where users just want to produce message without
worrying much about autowiring, injection and different properties to set for producer template.
**Describe the solution you'd like**
Just as for consumer we should provide a support for @PulsarProducer annotation.This annotation can be defined over public methods and object returned by the method will be published to pulsar topics.
Different configuration about the producer can be configured in @PulsarProducer annotation. Also we should have support for property resolution in @PulsarProducer as we have for @PulsarConsumer.
Contributor guide
Research direction
Start by reviewing the existing @PulsarConsumer support, especially how its annotation configuration and property resolution work. Define the corresponding @PulsarProducer behavior for public methods, including publishing returned objects and supporting producer configuration and property resolution; done means the annotation supports the requested basic producing use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, spring
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100