We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
How to include nats with Django application?
I'm trying run in from wsgi
def get_wsgi_application(): django.setup(set_prefix=False) run_messaging() return WSGIHandler() def run_messaging(): def start_loop(loop): asyncio.set_event_loop(loop) loop.run_until_complete(run(loop)) loop.run_forever() new_loop = asyncio.new_event_loop() t = Thread(target=start_loop, args=(new_loop,)) t.start() async def run(loop): async def vcm_calendar_create(msg): print("[{}] Received a message on queue subscription: {}".format(msg.sequence, msg.data)) nc = NATS() sc = STAN() client_id = f'calendar-sub-{os.getpid()}' await nc.connect(settings.FDLT_NATS_URL, token=settings.FDLT_NATS_TOKEN, io_loop=loop) await sc.connect(settings.FDLT_NATS_STREAM_CLUSTER_ID, client_id, nats=nc) await sc.subscribe(subject="vcm", queue='vcm.calendar.create', cb=vcm_calendar_create)
But handler vcm_calendar_create can't work with Django ORM
Can you write example how implement it?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How to include nats with Django application?
I'm trying run in from wsgi
But handler vcm_calendar_create can't work with Django ORM
Can you write example how implement it?
The text was updated successfully, but these errors were encountered: