Danube-Pubsub CLI - Produce messages
The produce
command sends messages to a specified topic with support for reliable delivery, custom schemas, and message attributes.
Basic Usage
Required Arguments
-
-s, --service-addr <SERVICE_ADDR>
The service URL for the Danube broker (e.g.,http://127.0.0.1:6650
) -
-m, --message <MESSAGE>
The message content to send -
-f, --file <FILE_PATH>
Binary file path to send (takes precedence over --message when specified)
Basic Options
-
-n, --producer-name <PRODUCER_NAME>
Producer identifier (default:test_producer
) -
-t, --topic <TOPIC>
Destination topic (default:/default/test_topic
) -
-p, --partitions <NUMBER>
Number of topic partitions
Message Configuration
-
-y, --schema <SCHEMA>
Message schema type:bytes
,string
,int64
,json
(default:string
) -
--json-schema <JSON_SCHEMA>
Required JSON schema definition when usingjson
schema type -
-a, --attributes <ATTRIBUTES>
Message attributes inkey1:value1,key2:value2
format -
-c, --count <COUNT>
Number of messages to send (default:1
) -
-i, --interval <INTERVAL>
Delay between messages in milliseconds (default: 500, minimum: 100)
Reliable Delivery Options
-
--reliable
Enable reliable message delivery with storage persistence -
--segment-size <SIZE>
Segment size in MB for reliable delivery (default: 20) -
--retention <POLICY>
Retention policy:ack
(retain until acknowledged) orexpire
(retain until time expires) (default: expire) -
--retention-period <SECONDS>
Retention period in seconds for reliable delivery (default:3600
) -
-h, --help
Description: Print help information
Example
Basic Message Production
JSON Messages with Schema
danube-cli produce -s http://localhost:6650 -c 100 \
-y json \
--json-schema '{"type": "object", "properties": {"field1": {"type": "string"}}}' \
-m '{"field1":"Hello Danube"}'
Reliable Message Delivery
danube-cli produce -s http://localhost:6650 -m "Hello Danube" -c 100 \
--reliable \
--segment-size 10 \
--retention expire \
--retention-period 7200