From b120e35e7bfe7f37b8a9cac96e38ce9bc3915e09 Mon Sep 17 00:00:00 2001 From: Adam Charnock Date: Wed, 18 Apr 2018 00:02:03 +0100 Subject: [PATCH] Changing name -> consumer_name --- lightbus/bus.py | 3 ++- lightbus/transports/base.py | 8 ++++---- lightbus/transports/debug.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lightbus/bus.py b/lightbus/bus.py index 1439d9c5..a4f950ae 100644 --- a/lightbus/bus.py +++ b/lightbus/bus.py @@ -382,7 +382,8 @@ async def listen_for_events(self, options = options or {} # Set a random default name for this new consumer we are creating - options.setdefault('name', random_name(length=4)) + # TODO: Test this gets used + options.setdefault('consumer_name', random_name(length=4)) listener_context = {} async def listen_for_event_task(event_transport, events): diff --git a/lightbus/transports/base.py b/lightbus/transports/base.py index dd94af5b..caade43b 100644 --- a/lightbus/transports/base.py +++ b/lightbus/transports/base.py @@ -90,7 +90,7 @@ async def send_event(self, event_message: EventMessage, options: dict): """Publish an event""" raise NotImplementedError() - def consume(self, listen_for: List[Tuple[str, str]], context: dict, name: str = None, **kwargs): + def consume(self, listen_for: List[Tuple[str, str]], context: dict, consumer_name: str = None, **kwargs): """Consume messages for the given APIs Examples: @@ -110,10 +110,10 @@ def consume(self, listen_for: List[Tuple[str, str]], context: dict, name: str = 'EventTransport.consume() was called without providing anything ' 'to listen for in the "listen_for" argument.' ) - name = name or random_name(length=4) - return self.fetch(listen_for, context, name, **kwargs) + consumer_name = consumer_name or random_name(length=4) + return self.fetch(listen_for, context, consumer_name, **kwargs) - async def fetch(self, listen_for: List[Tuple[str, str]], context: dict, name: str, **kwargs) -> Generator[EventMessage, None, None]: + async def fetch(self, listen_for: List[Tuple[str, str]], context: dict, consumer_name: str, **kwargs) -> Generator[EventMessage, None, None]: """Consume RPC messages for the given events Events the bus is not listening for may be returned, they diff --git a/lightbus/transports/debug.py b/lightbus/transports/debug.py index ef1216e5..14130e46 100644 --- a/lightbus/transports/debug.py +++ b/lightbus/transports/debug.py @@ -60,7 +60,7 @@ async def send_event(self, event_message: EventMessage, options: dict): event_message.kwargs )) - async def fetch(self, listen_for: List[Tuple[str, str]], context: dict, name: str, **kwargs) -> Generator[EventMessage, None, None]: + async def fetch(self, listen_for: List[Tuple[str, str]], context: dict, consumer_name: str, **kwargs) -> Generator[EventMessage, None, None]: """Consume RPC events for the given API""" logger.info("⌛ Faking listening for events {}.".format(self._events))