def messaging_poke(rt_settings, id_, email, tag, result_key, context, service_identity, user_details, timestamp): handler = POKE_TAG_MAPPING.get(parse_to_human_readable_tag(tag)) if not handler: logging.info('Ignoring poke with tag %s', tag) return None user_details = log_and_parse_user_details(user_details[0]) result = handler(email, tag, result_key, context, service_identity, user_details) return result and serialize_complex_value(result, PokeCallbackResultTO, False, skip_missing=True)
def messaging_update(rt_settings, request_id, status, answer_id, received_timestamp, member, message_key, tag, acked_timestamp, parent_message_key, service_identity, user_details, **kwargs): if not is_flag_set(Message.STATUS_ACKED, status): return None user_details = log_and_parse_user_details(user_details) f = FMR_TAG_MAPPING.get(parse_to_human_readable_tag(tag)) if not f: return None result = f(status, answer_id, received_timestamp, member, message_key, tag, acked_timestamp, parent_message_key, service_identity, user_details) return result and serialize_complex_value(result, MessageAcknowledgedCallbackResultTO, False, skip_missing=True)
def flow_member_result(rt_settings, request_id, message_flow_run_id, member, steps, end_id, end_message_flow_id, parent_message_key, tag, result_key, flush_id, flush_message_flow_id, service_identity, user_details, flow_params, **kwargs): user_details = log_and_parse_user_details(user_details) steps = parse_complex_value(object_factory("step_type", FLOW_STEP_MAPPING), steps, True) f = FMR_TAG_MAPPING.get(parse_to_human_readable_tag(tag)) if not f: logging.info('[tff] Ignoring flow_member_result with tag %s', tag) return None result = f(message_flow_run_id, member, steps, end_id, end_message_flow_id, parent_message_key, tag, result_key, flush_id, flush_message_flow_id, service_identity, user_details, flow_params) return result and serialize_complex_value( result, FlowMemberResultCallbackResultTO, False, skip_missing=True)
def flow_member_result(rt_settings, request_id, message_flow_run_id, member, steps, end_id, end_message_flow_id, parent_message_key, tag, result_key, flush_id, flush_message_flow_id, service_identity, user_details, flow_params, timestamp, **kwargs): user_details = log_and_parse_user_details(user_details) steps = parse_complex_value(object_factory("step_type", FLOW_STEP_MAPPING), steps, True) f = FMR_TAG_MAPPING.get(parse_to_human_readable_tag(tag)) should_process_flush = f and not flush_id.startswith('flush_monitoring') result = None try: if should_process_flush: logging.info('Processing flow_member_result with tag %s and flush_id %s', tag, flush_id) result = f(message_flow_run_id, member, steps, end_id, end_message_flow_id, parent_message_key, tag, result_key, flush_id, flush_message_flow_id, service_identity, user_details, flow_params) return result and serialize_complex_value(result, FlowMemberResultCallbackResultTO, False, skip_missing=True) else: logging.info('[tff] Ignoring flow_member_result with tag %s and flush_id %s', tag, flush_id) finally: deferred.defer(save_flow_statistics, parent_message_key, steps, end_id, tag, flush_id, flush_message_flow_id, user_details[0], timestamp, result)