riemann.transport

Functions used in several transports. Some netty parts transpire here since netty is the preferred method of providing transports

channel-group

(channel-group name)

Make a channel group with a given name.

channel-initializer

macro

(channel-initializer & names-and-exprs)

Constructs an instance of a Netty ChannelInitializer from a list of names and expressions which return handlers. Handlers with :shared metadata on their names are bound once and re-used in every invocation of getPipeline(), other handlers will be evaluated each time.

(channel-pipeline-factory
           frame-decoder    (make-an-int32-frame-decoder)
  ^:shared protobuf-decoder (ProtobufDecoder. (Proto$Msg/getDefaultInstance))
  ^:shared msg-decoder      msg-decoder)

datagram->byte-buf-decoder

(datagram->byte-buf-decoder)

A decoder that turns DatagramPackets into ByteBufs.

derefable

(derefable f)

A simple wrapper for a netty future which on deref just calls (syncUninterruptibly f), and returns the future’s result.

event-executor

(event-executor)

Creates a new netty execution handler for processing events. Defaults to 1 thread per core.

handle

(handle core msg)

Handles a msg with the given core.

instrumentation

ioutil-lock

There’s a bug in JDK 6, 7, and 8 which can cause a deadlock initializing sse-server and netty concurrently; we serialize them with this lock. https://github.com/riemann/riemann/issues/617

msg-decoder

(msg-decoder)

Netty decoder for Msg protobuf objects -> maps

msg-encoder

(msg-encoder)

Netty encoder for maps -> Msg protobuf objects

protobuf-decoder

(protobuf-decoder)

Decodes protobufs to Msg objects

protobuf-encoder

(protobuf-encoder)

Encodes protobufs to Msg objects

resolve-host

(resolve-host host)

Resolves a hostname to a random IP

retain

(retain x)

Retain a ReferenceCounted object, if x is such an object. Otherwise, noop. Returns x.

shared-event-executor

shutdown-event-executor-group

(shutdown-event-executor-group g)

Gracefully shut down an event executor group. Returns a derefable future.