natscli: JSON configuration generated cannot be consumed
When adding a Pull Consumer to a given stream through NATS CLI, I end up by exporting the JSON configuration running nats consumer info --json
for convenience of later configurations.
When consuming that configuration, using the same CLI version, I get the following error:
nats: error: Consumer creation failed: consumer in pull mode requires explicit ack policy (0)
The command I execute is nats consumer add --config=/configs/some_config.json
and I’m prompted to select the stream.
The following is the consumer configuration process:
docker-desktop:~# nats consumer add SOME-STREAM-NAME SOME-SUBJECT-NAME ? Delivery target (empty for Pull Consumers) SOME-SUBJECT-NAME.SOME-STREAM-NAME ? Delivery Queue Group ? Start policy (all, new, last, subject, 1h, msg sequence) all ? Acknowledgement policy [Use arrows to move, type to filter, ? for more help] ? Acknowledgement policy explicit ? Replay policy instant ? Maximum Allowed Deliveries -1 ? Maximum Acknowledgements Pending 1 ? Idle Heartbeat 30s ? Enable Flow Control, ie --flow-control Yes ? Deliver headers only without bodies No ? Add a Retry Backoff Policy Yes ? Backoff policy linear ? Minimum retry time 5s ? Maximum retry time 10s ? Number of steps to generate in the policy 5 Information for Consumer SOME-STREAM-NAME > SOME-SUBJECT-NAME created 2023-02-05T23:19:49Z
Configuration:
Durable Name: SOME-SUBJECT-NAME Delivery Subject: SOME-SUBJECT-NAME.SOME-STREAM-NAME Deliver Policy: All Ack Policy: Explicit Ack Wait: 30s Replay Policy: Instant
Maximum Deliveries: 6 Max Ack Pending: 1 Idle Heartbeat: 30.00s Flow Control: true
State:
Last Delivered Message: Consumer sequence: 0 Stream sequence: 0 Acknowledgment floor: Consumer sequence: 0 Stream sequence: 0 Outstanding Acks: 0 out of maximum 1 Redelivered Messages: 0 Unprocessed Messages: 0 Active Interest: No interest
The generated configuration is the following:
{
"stream_name": "SOME-STREAM-NAME",
"name": "SOME-SUBJECT-NAME",
"config": {
"ack_policy": "explicit",
"ack_wait": 30000000000,
"deliver_policy": "all",
"deliver_subject": "SOME-SUBJECT-NAME.SOME-STREAM-NAME",
"durable_name": "SOME-SUBJECT-NAME",
"flow_control": true,
"idle_heartbeat": 30000000000,
"max_ack_pending": 1,
"max_deliver": 6,
"replay_policy": "instant",
"num_replicas": 0
},
"created": "2023-02-05T23:19:49.984678331Z",
"delivered": {
"consumer_seq": 0,
"stream_seq": 0
},
"ack_floor": {
"consumer_seq": 0,
"stream_seq": 0
},
"num_ack_pending": 0,
"num_redelivered": 0,
"num_waiting": 0,
"num_pending": 0,
"cluster": {
"leader": "NBYPYKCAVIO2RVGDPAF34ECT5DGYPHJMH3YPKEEI6LIKUPD37G2WOZKU"
}
}
Anyone getting the same behaviour? Am I doing anything wrong?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18
this is fixed in main for the
jq .config
case, so next release should sort you out @tkeller-moxe