-
Notifications
You must be signed in to change notification settings - Fork 90
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
Send events from management commands #90
Comments
Hey, right now I got working the interprocess communication between management command |
For IPC, I think you'd want to communicate among |
@microHoffman Could you share some more details as how you managed to get the interprocess communication working? Thanks! |
Hey @tommyxd , I've ended up not using django-eventstream, but rather just django-channels. I've utilized the channel layers for the interprocess communication. For the sse consumer itself, I got inspired here: django/channels#1302 (comment) . |
I see, thanks for the pointer! So with that how do you send something from a management command to the consumer, are there any intricacies to it? |
You just (im not an expert so hopefully this makes sense:D):
from channels.layers import get_channel_layer
self.channel_layer = get_channel_layer()
async_to_sync(self.channel_layer.group_send)(recipient_address, {"type": type, "data": data}) Hopefully this makes sense:D |
Yep, it does make sense, thanks a lot! |
Hey, I'm trying to implement SSE notifications endpoint . I have the routing setup as follows:
The problem here is that I'd like to send the event (via
send_event
function) from separate management command, that handles the events and sending the notification and this management command runs on different process. I tried sending it directly from the management command, but unfortunately the event was not sent back to the client. If I understand this correctly, it's due thatrunserver
andevent_listener
management command run on different processes.So if I understand properly, I need to somehow pass to the
EventsConsumer
class the info that this event happened using django channels and then send the event from this consumer? I was also playing around with extending theEventsConsumer
, but unfortunately I was not able to implement this. If you have a spare minute and you have any idea how I could achieve this (sending events from managment commands), I'd greatly appreciate any help. Thanks!P.S: I've tried Pushpin, seems to be working alright, but ideally we would stick to the channels for more "standard" deployment.
The text was updated successfully, but these errors were encountered: