tree: f737c83afd309c0704761e2361d87d9e2608d62e [path history] [tgz]
  2. build.gradle
  3. src/

Gossip application

This application creates a sample standalone application applying the Plumtree gossip library.

$>bin/gossip --help
 Usage: <main class> [-h] [--sending] [--numberOfMessages=<numberOfMessages>]
                     [--sendInterval=<sendInterval>] [-c=<configPath>]
                     [-l=<port>] [-m=<messageLog>] [-n=<networkInterface>]
                     [-r=<rpcPort>] [-p[=<peers>...]]...
                             Number of messages to publish (load testing)
                             Size of the random payload to send to other peers (load
       --sending             Whether this peer sends random messages to all other
                               peers (load testing)
                             Interval to wait in between sending messages in
                               milliseconds (load testing)
   -c, --config=<configPath> Configuration file.
   -h, --help                Prints usage prompt
   -l, --listen=<port>       Port to listen on
   -m, --messageLog=<messageLog>
                             Log file where messages are stored
   -n, --networkInterface=<networkInterface>
                             Network interface to bind to
   -p, --peer[=<peers>...]   Static peers list
   -r, --rpc=<rpcPort>       RPC port to listen on

Example usage:

$>bin/gossip --sending --payloadSize 512 --sendInterval 200 -l 2000 -r 4000 -n -p tcp:// -p tcp://

You can configure this application to send random messages to other peers. The application can also open up a RPC port accepting messages to propagate:

$>curl -X POST http://localhost:4000/publish -d "hello"

The application optionally takes a config file (with the -c flag).

Default configuration:

listenPort = 0
rpcPort = 0
networkInterface = ""
peers = []
messagelog = "messages.log"
sending = false
sendInterval = 1000
payloadSize = 200

Sample sender configuration:

listenPort = 2000
rpcPort = 4000
networkInterface = ""
peers = [ "tcp://", "tcp://"]
messagelog = "messages.log"
sending = true
sendInterval = 1000
payloadSize = 200

Peers are encoded as URIs using the TCP scheme: tcp://

More information


Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.