如何使用 aiormq 向 rabbitMQ 发送整数参数。有了这个:
async def save_to_db(number: int):
# Perform connection
connection = await aiormq.connect("amqp://guest:guest@" + rabbitmqHost + "/")
# Creating a channel
channel = await connection.channel()
# Sending the message
await channel.basic_publish(number, routing_key=queueName)
我正进入(状态:
TypeError: object of type 'int' has no len()
我试图将它转换为字符串,然后它起作用了。我需要它是整数才能将其插入数据库。