(graceful-shutdown op connection subs-chan resp-chan)
Graceful shutdown:
/events
endpoint:connected
:none
message to subscribers but do not wait for response.
Subscribers should gracefully shutdownGraceful shutdown: 1. Close HTTP connection to SSE `/events` endpoint 2. Close subs-chan no new subscriptions can be accepted 3. unblock pending subscribers - subscribers that have already sent a subscription message and are blocking on subs-chan 4. send `:connected` `:none` message to subscribers but do not wait for response. Subscribers should gracefully shutdown 5. Unsubscribe core.async channels from sse-mult. 6. Close response channel,
(handle-response {:keys [command] :as op} response)
Handles response of command. Called after command has been executed and response has been received. This function just dispatches handler based on operation command and returns new operation with new command
Handles response of command. Called after command has been executed and response has been received. This function just dispatches handler based on operation command and returns new operation with new command
(sse client-atom subs-chan resp-chan)
Invoke salt.api/sse
request and returns resp-chan
which deliver SSE events, subscription responses and error.
This function creates go-loop that connects to SSE events, listens to
subs-chan
and write SSE to resp-chan
. It handles errors and authentication.
Messages taken from subs-chan
:
| Key | Description |
| -------------------| ------------|
| :type :subscribe | Add subscriber with correlation id
| :type :unsubscribe | Remove subscriber with correlation id
| :type :exit | Quit go-loop
Responses delivered to resp-chan
:
| Response | Description |
| -----------------| ------------|
| Exception | Error occurs and SSE could not be delivered (e.g. connection error and reconnect fails). Client should return error.
| :type :data
| SSE event. Body is parsed from JSON.
| :type :connect
| When subscription is made (with :correlation-id set) or on reconnect with :correlation-id set to :all
See salt.client/client
for configuration options.
Invoke [[salt.api/sse]] request and returns `resp-chan` which deliver SSE events, subscription responses and error. This function creates go-loop that connects to SSE events, listens to `subs-chan` and write SSE to `resp-chan`. It handles errors and authentication. Messages taken from `subs-chan`: | Key | Description | | -------------------| ------------| | :type :subscribe | Add subscriber with correlation id | :type :unsubscribe | Remove subscriber with correlation id | :type :exit | Quit go-loop Responses delivered to `resp-chan`: | Response | Description | | -----------------| ------------| | Exception | Error occurs and SSE could not be delivered (e.g. connection error and reconnect fails). Client should return error. | `:type :data` | SSE event. Body is parsed from JSON. | `:type :connect` | When subscription is made (with :correlation-id set) or on reconnect with :correlation-id set to :all See [[salt.client/client]] for configuration options.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close