def handle_event(self, config, event, conn_name): log.debug("Handling event: %s" % (event, )) # To avoid circular import. from go.vumitools.routing import RoutingMetadata endpoint = RoutingMetadata(event).next_router_endpoint() if endpoint is not None: self.publish_event(event, endpoint=endpoint)
def _add_go_routing_metadata(self, msg, hops, outbound_hops): rmeta = RoutingMetadata(msg) if hops is not None: rmeta.set_hops(hops) if outbound_hops is not None: rmeta.set_outbound_hops(outbound_hops)
def set_event_hops(self, event, outbound_hops, num_inbound_hops=1): rmeta = RoutingMetadata(event) rmeta.set_outbound_hops(outbound_hops) rev_hops = reversed(outbound_hops[-num_inbound_hops:]) for outbound_src, outbound_dst in rev_hops: rmeta.push_hop(outbound_dst, outbound_src)