Workers can't dynamically change their channels during runtime, but you can tell workers to only run specific channels in one of two ways:
- Have different routing configurations and different settings files that point to each for the two worker groups - Use the --only-channels and --exclude-channels arguments to runworker to restrict which channels it will process. You can still only do this once at the start of the application, though. There's no way to dynamically vary what a worker wants at runtime because of how the Channels framework is written and integrated into Django; you'd have to do your own ASGI worker class from scratch if you wanted that. Andrew On Sun, Mar 19, 2017 at 5:57 AM, Alexander Prokhorov <prok...@gmail.com> wrote: > Dear Colleagues, > > I am playing with Channels for some time already. > > Now, I am trying to establish "sticky" channel to one of available > workers. I thought I can create single-reader channel from consumer and > somehow fix the routing to make this particular worker handle this > single-reader channel. I can use > > channels.channel_layers[channels.DEFAULT_CHANNEL_LAYER].new_channel( > "my_exclusive_channel?") > > in consumer core to create single-reader channel, but I cannot understand > how to setup routing properly in such case. I tried to implement router > object from scratch, but as I see its method `channel_names` invoked only > one time per worker. In other words, the problems reduces to the question > if it is possible to attach some consumer to dynamically created > single-reader channel. > > > -- > 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 django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > 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/be4c787f-1abc-4ece-8b74-ad13ce7180eb%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/be4c787f-1abc-4ece-8b74-ad13ce7180eb%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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. 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/CAFwN1uot2foSc-9N7yVnBGuqwykn3k1vruAxX3wpF0p1JC%3Dr-A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.