Skip to content

Commit

Permalink
Changing name -> consumer_name
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcharnock committed Apr 17, 2018
1 parent c5de866 commit b120e35
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lightbus/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions lightbus/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lightbus/transports/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit b120e35

Please sign in to comment.