我需要从aiohttp服务发送消息到SQS队列。 我阅读了aiobotocore的文档和所有示例,但是我没有看到任何关于如何为example从aipg发送与postgres相同的消息的内容。你知道吗
async def pg_engine(app):
app['pg_engine'] = await create_engine(
user='postgre',
database='postgre',
host='localhost',
port=5432,
password=''
)
yield
app['pg_engine'].close()
await app['pg_engine'].wait_closed()
app.cleanup_ctx.append(pg_engine)
升级版 解决办法是
async def sqs_client(app):
session = get_session(loop=app.loop)
app['sqs'] = session.create_client('sqs',
endpoint_url=SQS_QUEUE_URL,
region_name=SQS_REGION)
yield
# close connection after finish
await app['sqs'].close()
app.cleanup_ctx.append(sqs_client)
目前没有回答
相关问题 更多 >
编程相关推荐