Reputation: 61
I have multiple consumers, and wanted to pass a value from one consumer to the other using self.scope['sessions']
. They are both created and initialized at the same time.
After setting and saving (self.scope['sessions'].save())
session value, I am trying to get this session value in 2nd consumer, but the value stored at self.scope
in 2nd consumer will still be the value at the time this 2nd consumer was initialized (or connected).
I am looking for a way to refresh or reload the self.scope
in 2nd consumer so that I can use the self.scope['sessions']
value from the 1st consumer. thanks.
Upvotes: 1
Views: 391
Reputation: 826
You can't do that since consumers start persistent connections. I think you should use the channel layer; basically, you need to use a message broker to send data between consumers.
https://channels.readthedocs.io/en/stable/topics/channel_layers.html
Upvotes: 3