Liking cljdoc? Tell your friends :D

s-exp.hirundo.grpc


bidi-async-handlerclj

(bidi-async-handler f
                    &
                    {:keys [in-ch-fn out-ch-fn]
                     :or {in-ch-fn (fn* [] (async/chan 16))
                          out-ch-fn (fn* [] (async/chan 16))}})

Wraps (fn [in-ch out-ch]) as a :bidi handler.

Incoming client messages arrive on in-ch; it is closed when the client signals completion or an error occurs. Put response messages onto out-ch and close it to end the stream.

Options:

  • :in-ch-fn — zero-arg fn returning the incoming channel (default: #(async/chan 16))
  • :out-ch-fn — zero-arg fn returning the outgoing channel (default: #(async/chan 16))
Wraps `(fn [in-ch out-ch])` as a `:bidi` handler.

Incoming client messages arrive on `in-ch`; it is closed when the client
signals completion or an error occurs. Put response messages onto `out-ch`
and close it to end the stream.

Options:
* `:in-ch-fn`  — zero-arg fn returning the incoming channel (default: `#(async/chan 16)`)
* `:out-ch-fn` — zero-arg fn returning the outgoing channel (default: `#(async/chan 16)`)
raw docstring

client-stream-async-handlerclj

(client-stream-async-handler f
                             &
                             {:keys [in-ch-fn out-ch-fn]
                              :or {in-ch-fn (fn* [] (async/chan 16))
                                   out-ch-fn (fn* [] (async/chan 1))}})

Wraps (fn [in-ch out-ch]) as a :client-stream handler.

Incoming client messages arrive on in-ch; it is closed when the client signals completion or an error occurs. Put response messages onto out-ch and close it to end the stream.

Options:

  • :in-ch-fn — zero-arg fn returning the incoming channel (default: #(async/chan 16))
  • :out-ch-fn — zero-arg fn returning the outgoing channel (default: #(async/chan 1))
Wraps `(fn [in-ch out-ch])` as a `:client-stream` handler.

Incoming client messages arrive on `in-ch`; it is closed when the client
signals completion or an error occurs. Put response messages onto `out-ch`
and close it to end the stream.

Options:
* `:in-ch-fn`  — zero-arg fn returning the incoming channel (default: `#(async/chan 16)`)
* `:out-ch-fn` — zero-arg fn returning the outgoing channel (default: `#(async/chan 1)`)
raw docstring

complete!clj

(complete! observer)
(complete! observer msg)

Signals successful stream completion to the client. With 2 args, sends msg first then completes — convenience for unary and single-response server-streaming handlers.

Signals successful stream completion to the client. With 2 args, sends
`msg` first then completes — convenience for unary and single-response
server-streaming handlers.
raw docstring

error!clj

(error! observer throwable)

Signals an error to the client via observer. throwable must be a java.lang.Throwable.

Signals an error to the client via `observer`. `throwable` must be a
`java.lang.Throwable`.
raw docstring

send!clj

(send! observer msg)

Sends msg to the client via observer.

Sends `msg` to the client via `observer`.
raw docstring

server-stream-async-handlerclj

(server-stream-async-handler f
                             &
                             {:keys [out-ch-fn]
                              :or {out-ch-fn (fn* [] (async/chan 16))}})

Wraps (fn [request out-ch]) as a :server-stream handler.

The user fn receives the request and a core.async channel. Put any number of response messages onto out-ch then close it to end the stream.

Options:

  • :out-ch-fn — zero-arg fn returning the outgoing channel (default: #(async/chan 16))
Wraps `(fn [request out-ch])` as a `:server-stream` handler.

The user fn receives the request and a `core.async` channel. Put any
number of response messages onto `out-ch` then close it to end the stream.

Options:
* `:out-ch-fn` — zero-arg fn returning the outgoing channel (default: `#(async/chan 16)`)
raw docstring

stream-observerclj

(stream-observer {:keys [on-next on-error on-completed]})

Returns a StreamObserver backed by callback fns supplied as a map:

  • :on-next(fn [msg]) — called for each incoming message
  • :on-error(fn [throwable]) — called on stream error
  • :on-completed(fn []) — called when the client signals completion

All keys are optional; unset callbacks are no-ops.

Returns a `StreamObserver` backed by callback fns supplied as a map:

 * `:on-next` — `(fn [msg])` — called for each incoming message
 * `:on-error` — `(fn [throwable])` — called on stream error
 * `:on-completed` — `(fn [])` — called when the client signals completion

All keys are optional; unset callbacks are no-ops.
raw docstring

unary-async-handlerclj

(unary-async-handler f
                     &
                     {:keys [out-ch-fn]
                      :or {out-ch-fn (fn* [] (async/chan 1))}})

Wraps (fn [request out-ch]) as a :unary handler.

The user fn receives the request and a core.async channel. Put exactly one response message onto out-ch then close it. Closing out-ch completes the stream.

Options:

  • :out-ch-fn — zero-arg fn returning the outgoing channel (default: #(async/chan 1))
Wraps `(fn [request out-ch])` as a `:unary` handler.

The user fn receives the request and a `core.async` channel. Put exactly
one response message onto `out-ch` then close it. Closing `out-ch`
completes the stream.

Options:
* `:out-ch-fn` — zero-arg fn returning the outgoing channel (default: `#(async/chan 1)`)
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close