use waddling_errors_macros::{component, component_location, diag};
component_location!(Queue);
component! {
Queue {
docs: "Background job processing system. Manages async tasks, job scheduling, retry logic, and worker pool management.",
examples: [
"E.Queue.Connection.NOT_FOUND: Message broker not found",
"B.Queue.Timeout.IN_PROGRESS: Job execution in progress (5/10 min)",
"W.Queue.Validation.INVALID: Job payload validation warning"
],
tags: ["async", "background-jobs", "workers"],
},
}
diag! {
<json, html>,
E.Queue.Connection.NOT_FOUND: {
message: "Message broker connection not found",
'CR 'Pub description: "The connection to the message broker (RabbitMQ, Redis, etc.) could not be established or was lost.",
'CR 'Pub hints: [
"Check broker service is running",
"Verify connection URL and credentials"
],
'CR 'Int hints: [
"Review broker connection pool settings",
"Check network connectivity to broker",
"Verify broker authentication credentials"
],
'R role: "Internal",
'R tags: ["queue", "broker", "connectivity"],
},
B.Queue.Timeout.IN_PROGRESS: {
message: "Background job execution in progress",
'CR 'Pub description: "The background job is still executing and has not completed yet. This is a blocking status indicating the operation is ongoing.",
'CR 'Pub hints: [
"Wait for completion",
"Check progress status"
],
'CR 'Dev hints: [
"Monitor job execution time",
"Review timeout settings if taking too long",
"Check worker health status"
],
'R role: "Developer",
'R tags: ["queue", "jobs", "async"],
},
E.Queue.Timeout.CANCELLED: {
message: "Background job cancelled by user/timeout",
'CR 'Pub description: "The background job was cancelled either by user request or because it exceeded the maximum execution time.",
'CR 'Pub hints: [
"Check cancellation reason",
"Retry if needed"
],
'CR 'Dev hints: [
"Review job timeout configuration",
"Implement job cleanup logic",
"Check cancellation source (user/timeout/system)"
],
'R role: "Developer",
'R tags: ["queue", "jobs", "cancellation"],
},
W.Queue.Validation.INVALID: {
message: "Job payload validation warning",
'CR 'Pub description: "The job payload failed validation but the job will continue with best-effort processing or default values.",
'CR 'Pub hints: [
"Review payload schema",
"Check required fields"
],
'CR 'Dev hints: [
"Validate data types and formats",
"Update job producers to send correct payload",
"Review schema validation rules"
],
'R role: "Developer",
'R tags: ["queue", "validation", "jobs"],
},
K.Queue.Data.COMPLETED: {
message: "Background job completed successfully",
'CR 'Pub description: "The background job has finished executing successfully. Results are available and any side effects have been applied.",
'CR 'Pub hints: [
"Retrieve job results if needed"
],
'CR 'Dev hints: [
"Clean up temporary resources",
"Update job status in database",
"Trigger any post-completion hooks"
],
'R role: "Developer",
'R tags: ["queue", "jobs", "success"],
},
}