/th2-event-uploader-j

Primary LanguageKotlinApache License 2.0Apache-2.0

th2-event-uploader (0.0.1)

The event-uploader application reads events content from a jsonl file and publish it via th2 common library

Command line arguments

You can get actual list of arguments by the command

./event-uploader --help
usage: ./event-uploader [OPTIONS]
-b,--event-book <arg>           Book is used for for events id building.
                                `bookName` field from `box.json` config
                                is used by default.
-c,--th2-common-cfg-dir <arg>   Directory with th2 common configs
-e,--events-file <arg>          JSONL file with events
-h,--help                       Print commandline arguments
-n,--event-in-batch <arg>       Number of events in butch
-s,--event-scope <arg>          Scope is used for events id building.
                                `boxName` field from `box.json` config is
                                used by default.

Events file format (*.jsonl)

The file with events should contain lines with the next format. event-uploader reads this file and transform each line to th2 event

{
  "name": "My event name",
  "type": "My event type",
  "body": "{\"my-field\":123}",
  "attachedMessageIds": [
    {
      "book": "test_book",
      "alias": "my-message-alias",
      "group": "my-message-alias",
      "timestamp": 214302125226490,
      "sequence": 1
    }
  ]
}
  • name (optional) - name for published event. Default value is Unknown event name.
  • type (optional) - type for published event. Default value is Unknown event type.
  • body (optional) - body for published event. Event is built without body if this field is missed.
  • attachedMessageIds (optional) - list of attached message ids for published event. Event is built without attached messages if this field is missed.

Note: book filed in all messages must be the same as -b/--event-book cmd arg

th2 common config (-c/--th2-common-cfg-dir cmd arg)

box.json

This config contains default value for book and scope for published events

{
  "bookName": "test_book",
  "boxName": "event-uploader"
}
  • bookName - this value is used as event book by default if -b/--event-book argument isn't passed
  • boxName - this value is used as event scope by default if -s/--event-scope argument isn't passed

prometheus.json

Disable prometheus HTTP server embedded into th2 common library

{
  "enabled": false
}

mq.json

You should create th2 entry point component by the next CR and grab mq.json config generated by th2-infra-operator or th2-pico

apiVersion: th2.exactpro.com/v2
kind: Th2Box
metadata:
  name: script
spec:
  imageName: dev-script
  imageVersion: dev-script
  type: th2-script
  extendedSettings:
    k8sProbes: false
    externalBox:
      enabled: true
    hostNetwork: false
    service:
      enabled: false

rabbitMQ.json

You should grab this config from th2 cluster or th2-pico you are going to connect