spring-cloud-alibaba
spring-cloud-alibaba copied to clipboard
refactor RocketMQProduceFactory: reuse producer
Describe what this PR does / why we need it
Refactor RocketMQProduceFactory: reuse producer
Does this pull request fix one issue?
Describe how you did it
- add a Map
private static Map<String, DefaultMQProducer> producers = new HashMap<>();
to store producers in the factory. - reuse the producer in the factory
Describe how to verify it
Create several output bindings, and the producer will be reused.
Special notes for reviews
Maybe Spring cloud stream had cache producer, we don't need to cache producer in spring cloud alibaba.
@steverao @zkzlx @yuhuangbin This PR may be reviewed and merged
Don't forget to create a same PR to branch of 2021.x.