Did you have luck with this. I've tried the same thing, but it seems like 
if no one is consuming on the other side I get a 
"channels.exceptions.ChannelFull" exception. 

I'm trying to provide a real-time feed for an exchange. There might be zero 
people listing or 1 million listening. The high level design should be the 
same. 



On Thursday, February 23, 2017 at 7:52:11 AM UTC-7, Jochen Breuer wrote:
>
> Hi Andrew,
>
> thanks for your very detailed answer! This is much simpler that 
> anticipated. You are absolutely right, a management command is the most 
> simple approach here. That was the missing piece in my picture. Thank you 
> very much!
>
> Jochen
>
>
>
>
>
>
> Am Mittwoch, 22. Februar 2017 19:55:33 UTC+1 schrieb Andrew Godwin:
>>
>> Hi Jochen,
>>
>> Your problem is that if you want to listen to the pubsub channel you will 
>> need a dedicated process to do so, as you can't just poll something like 
>> that. Given that restriction, you're going to have to write something like 
>> a management command that opens a connection to Redis and listens for 
>> messages, and then whenever it gets one, sends the message onto a channel 
>> in the Django channel system.
>>
>> You can send to channels from anywhere, so it's just a basic listener 
>> with one line of channel send added. You're likely to want some sort of 
>> logic on these messages, I suspect, so I would send onto a single custom 
>> channel and then, now your messages are in the evented channel system, you 
>> can then write a consumer for that channel and tie it into the routing and 
>> handle any distribution/storage there.
>>
>> This keeps the body of your logic inside the Django consumer code, and 
>> the management command nice and simple - it just needs to send onto a 
>> custom channel and not worry about what to do with that data, you can hook 
>> that up later. If you have fields in the message you split out into 
>> different dictionary keys, you can even use the Channels routing options on 
>> those fields - so, for example, you could route everything with a certain 
>> task name to one consumer, and everything else to a catch-all consumer.
>>
>> Andrew
>>
>> On Wed, Feb 22, 2017 at 6:55 AM, Jochen Breuer <[email protected]> wrote:
>>
>>> Hi!
>>>
>>> I'm not entirely sure where to start and I hope you can help me. I'm 
>>> using SaltStack to execute tasks on minions. The results of those jobs 
>>> (that's the term used in Salt) are then published to a job cache. In this 
>>> case its a Redis server (Redis Pubsub). Now I would like to subscribe to a 
>>> specific Redis channel, where the job results are published, with my Django 
>>> (Channels) application. Every time a job result is pushed, I'd also like to 
>>> push a message to a channel in Django.
>>>
>>> Where to begin? Do I need to write a new protocol server or just a 
>>> custom channel? Even after reading the docs I'm still lacking overview. 
>>> Perhaps someone can push me into the right direction. Thanks!
>>>
>>> Jochen
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/c933a5b5-7b72-4d7d-985a-a311c0f16b26%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/c933a5b5-7b72-4d7d-985a-a311c0f16b26%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bf19a22-c6e7-4a36-80b4-f06c77528437%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to