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

多次实例化Producer会出现TBW102异常 #99

Open
Kenshinhu opened this issue Jun 1, 2020 · 3 comments
Open

多次实例化Producer会出现TBW102异常 #99

Kenshinhu opened this issue Jun 1, 2020 · 3 comments

Comments

@Kenshinhu
Copy link

Kenshinhu commented Jun 1, 2020

变量多次实例化Producer会出现 以下问题:
No topic route info in name server for the topic: TBW102
See http://rocketmq.apache.org/docs/faq/ for further details.
See http://rocketmq.apache.org/docs/faq/ for further details.

如果是仅实例一次 client 就不会出现这个问题
如果producer 多次实例化就就会出现

class MQProducerService extends Service { async send(topic, tags, payload, opts) { const logger = this.ctx.logger; const producer = new Producer(opts); let sendResult; try { const msg = new Message(topic, tags, JSON.stringify(payload)); sendResult = await producer.send(msg); } catch (err) { logger.error(err); } return sendResult; } }

@Kenshinhu Kenshinhu changed the title 变量多次实例化Producer会出现 TBW102 多次实例化Producer会出现TBW102异常 Jun 1, 2020
@denghongcai
Copy link
Collaborator

用法不太对,不要每次都重新初始化 Provider,要复用

@Kenshinhu
Copy link
Author

用法不太对,不要每次都重新初始化 Provider,要复用

那有没有方法可以 销毁 Provider? 因为Producer 需要动态实例化

@Yuan-ZW
Copy link

Yuan-ZW commented Mar 5, 2021

同样的问题, 我是多次实例化Consumer时报错.。
我的需求是能在多个 nameSrv、namespace、topic等不同的 mq之间切换连接。
如果能够复用的话当然也可以, 不过我没有找到相关文档。

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

No branches or pull requests

3 participants