Socket

The socket consumer reads messages as-is from a given network or filesystem socket. Messages are separated from the stream by using a specific partitioner method.

Parameters

Enable (default: true)

Switches this plugin on or off.

Address

This value defines the protocol, host and port or socket to bind to. This can either be any ip address and port like “localhost:5880” or a file like “unix:///var/gollum.socket”. Valid protocols can be derived from the golang net package documentation. Common values are “udp”, “tcp” and “unix”. By default this parameter is set to “tcp://0.0.0.0:5880”.

Permissions (default: 0770)

This value sets the filesystem permissions for UNIX domain sockets as a four-digit octal number. By default this parameter is set to “0770”.

Acknowledge

This value can be set to a non-empty value to inform the writer that data has been accepted. On success, the given string is sent. Any error will close the connection. Acknowledge does not work with UDP based sockets. By default this parameter is set to “”.

Partitioner

This value defines the algorithm used to read messages from the router. By default this is set to “delimiter”. The following options are available:

“delimiter”

Separates messages by looking for a delimiter string. The delimiter is removed from the message.

“ascii”

Reads an ASCII number at a given offset until a given delimiter is found. Everything to the right of and including the delimiter is removed from the message.

“binary”

Reads a binary number at a given offset and size.

“binary_le”

An alias for “binary”.

“binary_be”

The same as “binary” but uses big endian encoding.

“fixed”

Assumes fixed size messages.

Delimiter (default: n)

This value defines the delimiter used by the text and delimiter partitioners. By default this parameter is set to “n”.

Offset (default: 0)

This value defines the offset used by the binary and text partitioners. This setting is ignored by the fixed partitioner. By default this parameter is set to “0”.

Size

This value defines the size in bytes used by the binary and fixed partitioners. For binary, this can be set to 1,2,4 or 8. The default value is 4. For fixed , this defines the size of a message. By default this parameter is set to “1”.

ReconnectAfterSec (default: 2, unit: sec)

This value defines the number of seconds to wait before a connection is retried. By default this parameter is set to “2”.

AckTimeoutSec (default: 1, unit: sec)

This value defines the number of seconds to wait for acknowledges to succeed. By default this parameter is set to “1”.

ReadTimeoutSec (default: 2, unit: sec)

This value defines the number of seconds to wait for data to be received. This setting affects the maximum shutdown duration of this consumer. By default this parameter is set to “2”.

RemoveOldSocket (default: true)

If set to true, any existing file with the same name as the socket (unix://<path>) is removed prior to connecting. By default this parameter is set to “true”.

Parameters (from core.SimpleConsumer)

Streams

Defines a list of streams a consumer will send to. This parameter is mandatory. When using “*” messages will be sent only to the internal “*” stream. It will NOT send messages to all streams. By default this parameter is set to an empty list.

ShutdownTimeoutMs (default: 1000, unit: ms)

Defines the maximum time in milliseconds a consumer is allowed to take to shut down. After this timeout the consumer is always considered to have shut down. By default this parameter is set to 1000.

Modulators

Defines a list of modulators to be applied to a message before it is sent to the list of streams. If a modulator specifies a stream, the message is only sent to that specific stream. A message is saved as original after all modulators have been applied. By default this parameter is set to an empty list.

ModulatorRoutines

Defines the number of go routines reserved for modulating messages. Setting this parameter to 0 will use as many go routines as the specific consumer plugin is using for fetching data. Any other value will force the given number fo go routines to be used. By default this parameter is set to 0

ModulatorQueueSize

Defines the size of the channel used to buffer messages before they are fetched by the next free modulator go routine. If the ModulatorRoutines parameter is set to 0 this parameter is ignored. By default this parameter is set to 1024.

Examples

This example open a socket and expect messages with a fixed length of 256 bytes:

socketIn:
  Type: consumer.Socket
  Address: unix:///var/gollum.socket
  Partitioner: fixed
  Size: 256