How to use the rele.config.load_subscriptions_from_paths function in rele

To help you get started, we’ve selected a few rele examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mercadona / rele / tests / View on Github external
def test_loads_subscriptions_when_they_are_class_based(self):
        subscriptions = load_subscriptions_from_paths(
            filter_by=[lambda attrs: attrs.get("lang") == "en"],

        assert len(subscriptions) == 2
        klass_sub = subscriptions[0]
        assert isinstance(klass_sub, Subscription)
        assert == "test-alternative-cool-topic"
        assert klass_sub({"id": 4}, lang="en") == 4
github mercadona / rele / tests / View on Github external
def subscriptions(self):
        return load_subscriptions_from_paths(
            filter_by=[lambda args: args.get("lang") == "en"],
github mercadona / rele / rele / management / commands / View on Github external
def handle(self, *args, **options):
        headers = ["Topic", "Subscriber(s)", "Sub"]

        subscription_paths = discover_subs_modules()
        subs = sorted(
            key=lambda sub: sub.topic,
        sub_data = [(sub.topic,, sub._func.__name__) for sub in subs]

        self.stdout.write(tabulate(sub_data, headers=headers))