Class: NatsWork::Protocol::Schema
- Inherits:
-
Object
- Object
- NatsWork::Protocol::Schema
- Defined in:
- lib/natswork/protocol.rb
Overview
Message schemas
Class Method Summary collapse
-
.job_error ⇒ Object
Job error message schema.
-
.job_request ⇒ Object
Job request message schema.
-
.job_response ⇒ Object
Job response message schema.
-
.worker_heartbeat ⇒ Object
Worker heartbeat schema.
Class Method Details
.job_error ⇒ Object
Job error message schema
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/natswork/protocol.rb', line 85 def self.job_error { type: MessageType::JOB_ERROR, version: VERSION, job_id: 'string (UUID)', error_code: 'string (ErrorCode)', error_message: 'string', error_class: 'string', backtrace: 'array of strings (optional)', metadata: { occurred_at: 'ISO8601 timestamp', worker_id: 'string', worker_language: 'string', retry_count: 'integer', retryable: 'boolean', retry_at: 'ISO8601 timestamp (optional)' } } end |
.job_request ⇒ Object
Job request message schema
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/natswork/protocol.rb', line 39 def self.job_request { type: MessageType::JOB_REQUEST, version: VERSION, job_id: 'string (UUID)', job_class: 'string', queue: 'string', arguments: 'array|hash', metadata: { created_at: 'ISO8601 timestamp', enqueued_at: 'ISO8601 timestamp', retry_count: 'integer', max_retries: 'integer', timeout: 'integer (seconds)', language: 'string (optional)', language_version: 'string (optional)', worker_constraints: 'hash (optional)', priority: 'integer (optional)', idempotency_key: 'string (optional)', correlation_id: 'string (optional)', parent_job_id: 'string (optional)' } } end |
.job_response ⇒ Object
Job response message schema
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/natswork/protocol.rb', line 65 def self.job_response { type: MessageType::JOB_RESPONSE, version: VERSION, job_id: 'string (UUID)', status: 'success|failure|partial', result: 'any', metadata: { started_at: 'ISO8601 timestamp', completed_at: 'ISO8601 timestamp', duration_ms: 'float', worker_id: 'string', worker_language: 'string', worker_version: 'string', retry_count: 'integer' } } end |
.worker_heartbeat ⇒ Object
Worker heartbeat schema
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/natswork/protocol.rb', line 106 def self.worker_heartbeat { type: MessageType::WORKER_HEARTBEAT, version: VERSION, worker_id: 'string', timestamp: 'ISO8601 timestamp', status: 'running|paused|stopping', stats: { jobs_processed: 'integer', jobs_failed: 'integer', active_jobs: 'integer', queues: 'array of strings', concurrency: 'integer', memory_usage: 'integer (bytes)', cpu_usage: 'float (percentage)', uptime_seconds: 'integer' }, capabilities: { language: 'string', language_version: 'string', protocol_version: 'string', supported_job_types: 'array (optional)', max_job_size: 'integer (bytes)', features: 'array of strings' } } end |