apache / apache/rocketmq-client-python
The producer group has been created before, specify another name please.
- 主要語言
- Python
- 星號
- 305
- 分支
- 98
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I am using rocketmq in the flash application.
But when the application wants to send a message the second time, it meets this exeception
**The producer group has been created before, specify another name please.**
Here is my code:
`
from rocketmq.client import Producer, Message
import json
import uuid
from config import Config
def send_message(message):
'''
发送消息队列
:param message: 消息体,必须是字典或json格式
:return:
'''
group = Config.getConfig().MSG_GROUP
# group = str(uuid.uuid4())
topic = Config.getConfig().MSG_GROUP
addr = Config.getConfig().MSG_ADDR
producer = Producer(group)
producer.set_namesrv_addr(addr) # rocketmq队列接口地址(服务器ip:port)
producer.start()
msg = Message(topic)
msg.set_tags('python_compare_tag')
msg.set_body(str(json.dumps(message)))
producer.send_sync(msg)
producer.shutdown()
`
Question:
1. Does the app need to create a new group every time?
2. If not, how should I change the code to solve this execption?
3. Does rocketmq has some framework with flask app?
貢獻指南
研究方向
Start with the send_message snippet in the issue, especially the Producer construction, start, send_sync, and shutdown sequence. Check the RocketMQ Python client's producer lifecycle and group behavior to determine the expected reuse pattern and whether Flask integration is relevant. Done means the exception's cause and a supported resolution are documented for this example.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- distributed-systems
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100