Xtomp handbook

Configuration

Configuration guide.

The /etc/xtomp.conf file that is distributed with xtomp serves as its own configuration guide.

#
# This is the main xtomp server configuration file.  It contains the
# configuration directives that give the server its instructions.
#
# You may simply read the instructions in here without understanding
# what they do.  They're self explanatory. You're welcome.
#

#
# If the master process is started as root the 
# worker process is forked as this user.
#
user  xtomp;

#
# Number of processes, this MUST be 1
#
worker_processes  1;

#
# When starting a process the program tries to set the number of open file
# handles limit to this number. This may fail if the root user does not run
# the master process or this value is above the hard limits defined
# in /proc/sys/fs/file-max
#
worker_rlimit_nofile 2048;

#
# Use syslog (old/bsd rfc3164/udp)
# By using syslog you can arrangenot to log anything locally
#
#error_log syslog:server=127.0.0.1 info;

#
# Log file name plus the log level.
# one of: emerg,alert,crit,error,warn,notice,info,debug
#
error_log  /var/log/xtomp/error.log error;

#
# File to which the process ID of the master process is written.
#
pid        /var/run/xtomp/xtomp.pid;

#
# Configure the evens module.
#
events {
    #
    # Number of worker connections, one is needed per TCP connection.
    #
    worker_connections 1024;
}

#
# Setup the broker that talks STOMP protocol.
#
xtomp {

    #
    # Currently name is not used in xtomp.
    # STOMP protocol supports vhosting ala HTTP/1.1.
    #
    server_name xtomp.example.com;

    server {
        #
        # Ports to listen on, required, typically 61613.
        # 
        # 61613 is "trusted" assumed to be not from the Internet.
        #
        listen         61613;
        #
        # 80, 81, & 8000 - 8099 are considered web ports
        # 8080 is used by xtomp-console
        #
        listen         8080;
        #listen         80;

        #
        # If login is present CONNECT frames must send 
        # the login and passcode headers.
        #
        #login          xtomp;

        #
        # Password, required if login is set.
        #
        #passcode       passcode;

        #
        # Shared secret used to generate auth tokens
        # This should be a looooooooong complex password, 
        # if not, its printed to stdout cos you obviously don't care.
        #
        # Consider using xtomp-auth/make-secret.sh
        #
        #secret       XIxoIl6ngolYKQOrXpunRLCMWxR6O0lDI+HycNN4Ffo=;

        #
        # How long auth tokes are valid for (time in millis, resolution of seconds)
        #
        secret_timeout       60000;

        #
        # Enable WebSockets protocol
        #
        # When enabled all ports serve STOMP & WebSockets & limited HTTP features.
        # Its possible to deny read or write access via WS to individual destinations.
        #
        #websockets         on;

        #
        # Enable WebSockets protocol (comma separated list no spaces)
        #
        #websockets_origin    http://xtomp.example.com,http://example.com;

        #
        # Destinations are either queues or topics
        #
        destination {

            #
            # type: memtop, memory based pub/sub topic.
            #

            #
            # Destination name, use http://sanename.org values
            #
            name             memtop;

            #
            # Max clients that connect to this topic.
            # Connections are also limited by events:worker_connections
            #
            max_connections  1000;

            #
            # Max messages the destination can queue, when this limit is 
            # reached SEND frames will fail with the message "q flup".
            #
            max_messages     100;

            #
            # Maximum message size (1Mb)
            #
            max_message_size 1048576;

            #
            # Log destination size periodically to the error.log or to /xtomp/stat topic
            #
            #stats            on;

            #
            # Defeats the object of an in-memory broker, saves all messages to disk.
            # This is very inefficient: 4 blocking write()s per message.
            # Useful for testing and low write scenarios.
            #
            #log_messages    on;

        }

        destination {
            name             memq;
            #
            # The minimum number of times a message must be delivered
            # to be considered sent.
            # When 0 messages are not stored if there are no subscribers.
            # When 1 the destination behaves like a queue and messages are 
            # buffed until they are read. (or max_messages limit is reached)
            #
            min_delivery     1;

            max_connections  1;
            max_messages     100;
        }

        #
        # Magic topic, if this exists, statistics are published here
        #
        destination {
            name             /xtomp/stat;
            #
            # this flag prevents read access (SUBSCRIBE) from the web
            #
            web_read_block   on;
            #
            # this flag prevents write access (SEND) from the web
            #
            web_write_block   on;
        }
    }

}


by teknopaul