Did I find the right examples for you? yes no

All Samples(6)  |  Call(6)  |  Derive(0)  |  Import(0)
Broadcast ``message`` to all actors of the specified ``target_class``.

If no ``target_class`` is specified, the message is broadcasted to all
actors.

:param message: the message to send
:type message: picklable dict

:param target_class: optional actor class to broadcast the message to
:type target_class: class or class name

src/p/y/Pykka-1.2.0/tests/registry_test.py   Pykka(Download)
    def test_broadcast_sends_message_to_all_actors_if_no_target(self):
        ActorRegistry.broadcast({'command': 'foo'})
        for actor_ref in ActorRegistry.get_all():
            received_messages = actor_ref.proxy().received_messages.get()
            self.assert_({'command': 'foo'} in received_messages)
 
    def test_broadcast_sends_message_to_all_actors_of_given_class(self):
        ActorRegistry.broadcast({'command': 'foo'}, target_class=self.AnActor)
    def test_broadcast_sends_message_to_all_actors_of_given_class_name(self):
        ActorRegistry.broadcast({'command': 'foo'}, target_class='AnActor')
        for actor_ref in ActorRegistry.get_by_class(self.AnActor):
            received_messages = actor_ref.proxy().received_messages.get()
            self.assert_({'command': 'foo'} in received_messages)

src/p/y/pykka-HEAD/tests/registry_test.py   pykka(Download)
    def test_broadcast_sends_message_to_all_actors_if_no_target(self):
        ActorRegistry.broadcast({'command': 'foo'})
        for actor_ref in ActorRegistry.get_all():
            received_messages = actor_ref.proxy().received_messages.get()
            self.assert_({'command': 'foo'} in received_messages)
 
    def test_broadcast_sends_message_to_all_actors_of_given_class(self):
        ActorRegistry.broadcast({'command': 'foo'}, target_class=self.AnActor)
    def test_broadcast_sends_message_to_all_actors_of_given_class_name(self):
        ActorRegistry.broadcast({'command': 'foo'}, target_class='AnActor')
        for actor_ref in ActorRegistry.get_by_class(self.AnActor):
            received_messages = actor_ref.proxy().received_messages.get()
            self.assert_({'command': 'foo'} in received_messages)