Skip to content

EagerBroker #195

@xelhark

Description

@xelhark

Hi!

Have you ever considered adding an EagerBroker?

My problem is that during test case execution, the join method will hang indefinitely if there is any exception in my code (and since I'm testing, most of the time there actually is one 😄 )

Also, the exceptions aren't bubbled up so I don't see them during the execution of the tests.

I wrote this very simple EagerBroker, but I'm wondering if you think this is good enough, or if there's any better way to handle this kind of situation.

Just in case, I'll leave this here as a reference if anyone googles this:

class EagerBroker(StubBroker):
    def __init__(self):
        super(EagerBroker, self).__init__()

    def process_message(self, message):
        actor = self.get_actor(message.actor_name)
        actor(*message.args, **message.kwargs)

    def enqueue(self, message, *, delay=None):
        self.process_message(message)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions