createChannel

Creates a channel with the given name and schema, and adds it to the log.

Return

A new WriterChannel bound to this writer

Parameters

T

The type of objects written to this channel

name

The unique name for the channel

schema

The schema that encodes objects of type T

Throws

if a channel with the same name already exists


Creates a channel with the given name and a schema inferred from cls by reflection.

Return

A new WriterChannel bound to this writer

Parameters

T

The type of objects written to this channel

name

The unique name for the channel

cls

The class to infer the schema from

Throws

if a channel with the same name already exists


fun <T : Any> createChannel(name: String, cls: KClass<T>): <Error class: unknown class>

Creates a channel with the given name and a schema inferred from cls by reflection.

Type arguments are lost here. Use the reified overload for a type like Map<String, Double>.

Return

A new WriterChannel bound to this writer

Parameters

T

The type of objects written to this channel

name

The unique name for the channel

cls

The class to infer the schema from

Throws

if a channel with the same name already exists


Creates a channel whose schema is inferred from the reified type T, type arguments included. Prefer this to the KClass overload, which loses them.

val powers = writer.createChannel<Map<String, Double>>("Motors/Powers")
powers.put(mapOf("fl" to 0.5))

Return

A new WriterChannel bound to this writer

Parameters

T

The type of objects written to this channel

name

The unique name for the channel

See also

Throws

if a channel with the same name already exists, or if T cannot be schematized