Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions conserver/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ def before_processing(
vcon_id: str,
chain_details: Dict[str, Any],
context: Optional[Dict[str, Any]],
) -> None:
) -> Optional[str]:
"""Called before processing of a vCon starts.

Args:
vcon_id: The vCon identifier.
chain_details: The chain configuration for this processing run.
context: Optional context data (e.g. trace_id, span_id).

Returns:
The vCon identifier to continue chain processing, or a falsy value
(None / False / "") to skip processing for this vCon without raising
and without sending it to the DLQ. Mirrors the link contract.
"""
pass
return vcon_id


def after_processing(
Expand Down
7 changes: 6 additions & 1 deletion conserver/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,12 @@ def _handle_vcon(
try:
context = context or {}
context["ingress_list"] = ingress_list
hook.before_processing(vcon_id, chain_details, context)
if not hook.before_processing(vcon_id, chain_details, context):
logger.info(
"[%s] before_processing skipped vCon %s on ingress %s",
worker_name, vcon_id, ingress_list,
)
return
vcon_chain_request.process()
except Exception as e:
processing_error = e
Expand Down
Loading