Socket

The socket consumer reads messages directly as-is from a given socket. Messages are separated from the stream by using a specific partitioner method. When attached to a fuse, this consumer will stop accepting new connections (closing the socket) and close all existing connections in case that fuse is burned.

Parameters

Enable
Enable switches the consumer on or off. By default this value is set to true.
ID
ID allows this consumer to be found by other plugins by name. By default this is set to “” which does not register this consumer.
Stream
Stream contains either a single string or a list of strings defining the message channels this consumer will produce. By default this is set to “*” which means only producers set to consume “all streams” will get these messages.
Fuse
Fuse defines the name of a fuse to observe for this consumer. Producer may “burn” the fuse when they encounter errors. Consumers may react on this by e.g. closing connections to notify any writing services of the problem. Set to “” by default which disables the fuse feature for this consumer. It is up to the consumer implementation to react on a broken fuse in an appropriate manner.
Address
Address 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”. By default this is set to ”:5880”.
Permissions
Permissions sets the file permissions for “unix://” based connections as an four digit octal number string. By default this is set to “0770”.
Acknowledge
Acknowledge can be set to a non-empty value to inform the writer on success or error. On success the given string is send. Any error will close the connection. This setting is disabled by default, i.e. set to “”. If Acknowledge is enabled and a IP-Address is given to Address, TCP is used to open the connection, otherwise UDP is used. If an error occurs during write “NOT <Acknowledge>” is returned.
Partitioner

Partitioner defines the algorithm used to read messages from the stream. By default this is set to “delimiter”.

  • “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” is an alias for “binary”.
  • “binary_be” is the same as “binary” but uses big endian encoding.
  • “fixed” assumes fixed size messages.
Delimiter
Delimiter defines the delimiter used by the text and delimiter partitioner. By default this is set to “n”.
Offset
Offset defines the offset used by the binary and text partitioner. By default this is set to 0. This setting is ignored by the fixed partitioner.
Size
Size defines the size in bytes used by the binary or fixed partitioner. For binary this can be set to 1,2,4 or 8. By default 4 is chosen. For fixed this defines the size of a message. By default 1 is chosen.
ReconnectAfterSec
ReconnectAfterSec defines the number of seconds to wait before a connection is tried to be reopened again. By default this is set to 2.
AckTimoutSec
AckTimoutSec defines the number of seconds waited for an acknowledge to succeed. Set to 2 by default.
ReadTimoutSec
ReadTimoutSec defines the number of seconds that waited for data to be received. Set to 5 by default.
RemoveOldSocket
RemoveOldSocket toggles removing exisiting files with the same name as the socket (unix://<path>) prior to connecting. Enabled by default.

Example

- "consumer.Socket":
    Enable: true
    ID: ""
    Fuse: ""
    Stream:
        - "foo"
        - "bar"
    Address: ":5880"
    Permissions: "0770"
    Acknowledge: ""
    Partitioner: "delimiter"
    Delimiter: "\n"
    Offset: 0
    Size: 1
    ReconnectAfterSec: 2
    AckTimoutSec: 2
    ReadTimeoutSec: 5