def create_receiver(self, target_address, source_address=None, event_handler=None, name=None, properties=None): """Factory method for creating Receive links.""" ident = name or str(target_address) if ident in self._receiver_links: raise KeyError("Receiver %s already exists!" % ident) session = _SessionProxy("session-%s" % ident, self) session.open() rl = session.new_receiver(ident) rl.configure(target_address, source_address, event_handler, properties) self._receiver_links[ident] = rl return rl
def create_sender(self, source_address, target_address=None, event_handler=None, name=None, properties=None): """Factory method for Sender links.""" ident = name or str(source_address) if ident in self._sender_links: raise KeyError("Sender %s already exists!" % ident) session = _SessionProxy("session-%s" % ident, self) session.open() sl = session.new_sender(ident) sl.configure(target_address, source_address, event_handler, properties) self._sender_links[ident] = sl return sl