Class: PatientHttp::ProcessorObserver
- Inherits:
-
Object
- Object
- PatientHttp::ProcessorObserver
- Defined in:
- lib/patient_http/processor_observer.rb
Overview
Interface for observing request processing. A process observer can be registered with a Processor and receive events as requests are processed. Observers will run on the main processor thread and so should be lightweight and not do processing other than recording metrics or similar.
Instance Method Summary collapse
-
#capacity_exceeded ⇒ void
Called when a request cannot be enqueued because the processor is at capacity.
-
#request_end(request_task) ⇒ void
Called when a request finishes processing.
-
#request_enqueued(request_task) ⇒ void
Called when a request task is handed to the processor, before the task is visible to the reactor.
-
#request_error(error) ⇒ void
Called when a request encounters an error.
-
#request_rejected(request_task) ⇒ void
Called when a request task announced with request_enqueued was not accepted by the processor (not running or at capacity).
-
#request_requeued(request_task) ⇒ void
Called when an incomplete request task was re-enqueued through its task handler (processor shutdown or reactor failure).
-
#request_start(request_task) ⇒ void
Called when a request starts processing.
-
#start ⇒ void
Called when the processor starts.
-
#stop ⇒ void
Called when the processor stops.
Instance Method Details
#capacity_exceeded ⇒ void
This method returns an undefined value.
Called when a request cannot be enqueued because the processor is at capacity.
24 25 |
# File 'lib/patient_http/processor_observer.rb', line 24 def capacity_exceeded end |
#request_end(request_task) ⇒ void
This method returns an undefined value.
Called when a request finishes processing.
73 74 |
# File 'lib/patient_http/processor_observer.rb', line 73 def request_end(request_task) end |
#request_enqueued(request_task) ⇒ void
This method returns an undefined value.
Called when a request task is handed to the processor, before the task is visible to the reactor. The notification is guaranteed to arrive before request_start for the task, so observers can set up durable tracking (e.g. a crash-recovery registry entry) with no risk that the task completes first. If the processor does not accept the task, request_rejected is sent afterward. Unlike other notifications, an error raised here propagates from Processor#enqueue and rejects the task, so a failed tracking setup does not let the task be accepted as if it were durable.
39 40 |
# File 'lib/patient_http/processor_observer.rb', line 39 def request_enqueued(request_task) end |
#request_error(error) ⇒ void
This method returns an undefined value.
Called when a request encounters an error.
80 81 |
# File 'lib/patient_http/processor_observer.rb', line 80 def request_error(error) end |
#request_rejected(request_task) ⇒ void
This method returns an undefined value.
Called when a request task announced with request_enqueued was not accepted by the processor (not running or at capacity). Observers should tear down anything they set up in request_enqueued; the caller owns the request again once this is sent.
49 50 |
# File 'lib/patient_http/processor_observer.rb', line 49 def request_rejected(request_task) end |
#request_requeued(request_task) ⇒ void
This method returns an undefined value.
Called when an incomplete request task was re-enqueued through its task handler (processor shutdown or reactor failure). The task handler's job system owns the request again once this is sent, so observers should tear down any durable tracking for the task.
59 60 |
# File 'lib/patient_http/processor_observer.rb', line 59 def request_requeued(request_task) end |
#request_start(request_task) ⇒ void
This method returns an undefined value.
Called when a request starts processing.
66 67 |
# File 'lib/patient_http/processor_observer.rb', line 66 def request_start(request_task) end |
#start ⇒ void
This method returns an undefined value.
Called when the processor starts.
12 13 |
# File 'lib/patient_http/processor_observer.rb', line 12 def start end |
#stop ⇒ void
This method returns an undefined value.
Called when the processor stops.
18 19 |
# File 'lib/patient_http/processor_observer.rb', line 18 def stop end |