You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/11/02 14:25:05 UTC

[camel-performance-tests] 01/02: Added Nats-bulk script

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch nats-kafka-script
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 44477540ff1724f80bc20e68f2f20fc1fb8750f2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Nov 2 15:23:02 2021 +0100

    Added Nats-bulk script
---
 profiling/nats-kafka/scripts/nats-bulk.sh | 43 +++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/profiling/nats-kafka/scripts/nats-bulk.sh b/profiling/nats-kafka/scripts/nats-bulk.sh
new file mode 100755
index 0000000..4b3b1ab
--- /dev/null
+++ b/profiling/nats-kafka/scripts/nats-bulk.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+POSITIONAL=()
+while [[ $# -gt 0 ]]; do
+  key="$1"
+
+  case $key in
+    -n|--number)
+      NUMBER="$2"
+      shift # past argument
+      shift # past value
+      ;;
+    -b|--broker)
+      BROKER="$2"
+      shift # past argument
+      shift # past value
+      ;;
+    -t|--topic)
+      TOPIC="$2"
+      shift # past argument
+      shift # past value
+      ;;
+    -p|--payload)
+      PAYLOAD="$2"
+      shift # past argument
+      shift # past value
+      ;;
+    --default)
+      DEFAULT=YES
+      shift # past argument
+      ;;
+    *)    # unknown option
+      POSITIONAL+=("$1") # save it in an array for later
+      shift # past argument
+      ;;
+  esac
+done
+
+set -- "${POSITIONAL[@]}" # restore positional parameters
+
+for i in $(seq 1 $NUMBER)
+do nats-pub -s $BROKER $TOPIC $PAYLOAD
+done