nats-io / natscli

The NATS Command Line Interface
Apache License 2.0
498 stars 99 forks source link

Consumer --output doesn't record the stream name #68

Closed syacko closed 3 years ago

syacko commented 3 years ago

When running NATS CLI (v.0.0.21) and using the --output option, the stream name is not recorded.

√ workspace/sotesoft/dockerapi % nats consumer add --output=list.of.values.json business-service-layer list-of-values
? Delivery target pull
? Start policy (all, new, last, 1h, msg sequence) new
? Acknowledgement policy explicit
? Replay policy original
? Filter Stream by subject (blank for all) bsl.list-of-values.>
? Maximum Allowed Deliveries 2
? Maximum Acknowledgements Pending 
√ workspace/sotesoft/dockerapi % cat list.of.values.json 
{
  "durable_name": "list-of-values",
  "deliver_subject": "pull",
  "deliver_policy": "new",
  "ack_policy": "explicit",
  "max_deliver": 2,
  "filter_subject": "bsl.list-of-values.\u003e",
  "replay_policy": "original"
}%

When you run this output file as input using the --config option, the Steam name is prompted. This will cause an automated process for the installation of a consumer to hang.

Here is what happens when the above list.of.values file is used to create the consumer.

?1 workspace/sotesoft/dockerapi % nats consumer add --config=list.of.values.json 
? Select a Stream business-service-layer
Information for Consumer business-service-layer > list-of-values

Configuration:

        Durable Name: list-of-values
    Delivery Subject: pull
      Filter Subject: bsl.list-of-values.>
        Deliver Next: true
          Ack Policy: Explicit
            Ack Wait: 30s
       Replay Policy: Original
  Maximum Deliveries: 2

State:

   Last Delivered Message: Consumer sequence: 0 Stream sequence: 0
     Acknowledgment floor: Consumer sequence: 0 Stream sequence: 0
         Outstanding Acks: 0
     Redelivered Messages: 0
     Unprocessed Messages: 0

√ workspace/sotesoft/dockerapi % nats --version
0.0.21

Running on Mac OS 11.2.1

ripienaar commented 3 years ago

Yeah the consumer config don’t hold the stream name only the api call does. So the idea is you can use a consumer config on different streams uncanged

so you have to give the stream name as a argument “nats c create STREAM —config x.json”