зеркало из
1
0
Форкнуть 0
azure-event-hubs-node/testhub
Jeremy Meng 8eb89d186d Update Copyright header (#197) 2019-02-13 11:25:54 -08:00
..
commands Update Copyright header (#197) 2019-02-13 11:25:54 -08:00
utils Update Copyright header (#197) 2019-02-13 11:25:54 -08:00
README.md testhub changes 2018-07-10 21:46:52 -07:00
cli.ts Update Copyright header (#197) 2019-02-13 11:25:54 -08:00
package-lock.json update package-lock.json for testhub 2018-09-29 18:14:15 -07:00
package.json testhub updates 2018-09-24 19:06:34 -07:00
tsconfig.json Adding generated js files, tsconfig, package.json and other miscellaneous files. 2018-04-06 19:24:33 -07:00

README.md

Installing node.js on your box

You can install node.js from here. For installing node.js on a linux machine follow the instructions over here.

Installing this cli for testing

git clone https://github.com/amarzavery/azure-event-hubs-node/tree/rhea
cd azure-event-hubs-node/testhub
npm install -g .

Hub Testing CLI

testhub is a command line tool to help test Event Hub sending and receiving.

Usage

When simply executing testhub, you will be greeted with a help page. help can be called on each command.

 testhub --help
testhub [command]

Commands:
  testhub receive  Sends messages to an eventhub.
  testhub send     Sends messages to an eventhub.

Options:
  --version       Show version number                                  [boolean]
  -h, --help      Show help                                            [boolean]
  -c, --conn-str  EventHub connection string.                           [string]
  -n, --hub       Name of the EventHub.                      [string] [required]
  -a, --address   Address URI to the EventHub entity.                   [string]
  -k, --key-name  SAS key-name for the EventHub.                        [string]
  -v, --key       SAS key for the key-name.                             [string]

Send

  • Send with a connection string.
$ testhub send -c yourConnectionString
  • Send will by default send 1 messages of 256 bytes.
$ testhub send -a yourNamespace -n yourHub -k yourKeyName -v yourKey
  • You can specify more messages by using -b and -s.
$ testhub send -c yourConnectionString -b 100 -s 100
  • To cancel press Ctrl + c.
testhub send --help
testhub send

Sends messages to an eventhub.

Options:
  --version           Show version number                              [boolean]
  -h, --help          Show help                                        [boolean]
  -c, --conn-str      EventHub connection string.                       [string]
  -n, --hub           Name of the EventHub.                  [string] [required]
  -a, --address       Address URI to the EventHub entity.               [string]
  -k, --key-name      SAS key-name for the EventHub.                    [string]
  -v, --key           SAS key for the key-name.                         [string]
  -b, --msg-group     Number of events to group/batch.     [number] [default: 1]
  -t, --msg-count     Number of events to send in one iteration.
                                                        [number] [default: 1000]
  -s, --msg-size      size in bytes for each event.      [number] [default: 256]
  -p, --partition-id  The partitionId that the sender should send the event to.
                                                         [string] [default: "0"]
  -w, --wait          Number of seconds to sleep.          [number] [default: 0]
  -i, --iterations    Number of iterations to repeat the process of sending
                      messages. For sending messages forever, provide a
                      value less than 1.
                                                           [number] [default: 1]

Receive

  • Use a connection string to receive messages.
$ testhub receive -c yourConnectionString
  • Listen for messages on all partitions of a given Event Hub.
$ testhub receive -a yourNamespace -n yourHub -k yourKeyName -v yourKey
  • To cancel press Ctrl + c.
$ testhub receive --help
testhub receive

Receives messages from an eventhub.

Options:
  --version              Show version number                           [boolean]
  -h, --help             Show help                                     [boolean]
  -c, --conn-str         EventHub connection string.                    [string]
  -n, --hub              Name of the EventHub.               [string] [required]
  -a, --address          Address URI to the EventHub entity.            [string]
  -k, --key-name         SAS key-name for the EventHub.                 [string]
  -v, --key              SAS key for the key-name.                      [string]
  -d, --duration         The value must be in seconds. Receive messages for the
                         specified duration. Useful for benchmark testing.
                                                                        [number]
  -p, --partitions       Comma seperated partition IDs.  [string] [default: "0"]
  -g, --consumer         Consumer group name      [string] [default: "$default"]
  -o, --offset           Starting offset                [string] [default: "-1"]
  -f, --full-event-data  Display the complete EventData object.

Debug

  • If you would like to see more in-depth information about what is happening, export DEBUG=azure* or export DEBUG=azure*,rhea*.