def handle(self): with closing(self.odb.session()) as session: topic = pubsub_topic(session, self.request.input.cluster_id, self.request.input.id) if topic.last_pub_time: topic.last_pub_time = datetime_from_ms(topic.last_pub_time) self.response.payload = topic
def broker_message_hook(self, input, instance, attrs, service_type): if service_type == 'create_edit': with closing(self.odb.session()) as session: topic = pubsub_topic(session, input.cluster_id, instance.id) input.is_internal = topic.is_internal input.max_depth_gd = topic.max_depth_gd input.max_depth_non_gd = topic.max_depth_non_gd input.hook_service_id = topic.hook_service_id input.hook_service_name = topic.hook_service_name
def handle(self): with closing(self.odb.session()) as session: topic = pubsub_topic(session, self.request.input.cluster_id, self.request.input.id) topic['current_depth_gd'] = get_gd_depth_topic(session, self.request.input.cluster_id, self.request.input.id) last_data = get_last_pub_data(self.kvdb.conn, self.server.cluster_id, self.request.input.id) if last_data: topic['last_pub_time'] = last_data['pub_time'] self.response.payload = topic