Skip to content

Instantly share code, notes, and snippets.

@i-sam
Created December 20, 2013 17:35
Show Gist options
  • Save i-sam/8058430 to your computer and use it in GitHub Desktop.
Save i-sam/8058430 to your computer and use it in GitHub Desktop.
def _broadcast(self, command, arguments=None, destination=None,
reply=False, timeout=1, limit=None,
callback=None, channel=None):
if destination is not None and \
not isinstance(destination, (list, tuple)):
raise ValueError(
'destination must be a list/tuple not {0}'.format(
type(destination)))
arguments = arguments or {}
reply_ticket = reply and uuid() or None
chan = channel or self.connection.default_channel
# Set reply limit to number of destinations (if specified)
if limit is None and destination:
limit = destination and len(destination) or None
self._publish(command, arguments, destination=destination,
reply_ticket=reply_ticket,
channel=chan,
timeout=timeout)
if reply_ticket:
return self._collect(reply_ticket, limit=limit,
timeout=timeout,
callback=callback,
channel=chan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment