Skip to content

[Bug] pulsar-shell cannot produce message with quota and space #24319

Closed

Description

@berg223

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

Broker version (4.0.4)

Issue Description

Got error when I run command

./bin/pulsar-shell
client produce apache/pulsar/test-topic  -m "hello pulsar"

I believe it's a bug of pulsar-client-tools module after debug the source code.

Error messages

Unmatched argument at index 5: 'pulsar'
Usage: <main class> client produce [-chv] [-db] [-dr] [-ekn=<encKeyName>]
                                   [-ekv=<encKeyValue>] [-k=<key>]
                                   [-ks=<keySchema>]
                                   [-kvet=<keyValueEncodingType>]
                                   [-kvk=<keyValueKey>]
                                   [-kvkf=<keyValueKeyFile>]
                                   [-n=<numTimesProduce>] [-r=<publishRate>]
                                   [-s=<separator>] [-vs=<valueSchema>]
                                   [-f=<messageFileNames>]...
                                   [-m=<messages>]... [-p=<properties>]...
                                   <topic>
Produce messages to a specified topic
      <topic>                TopicName
  -c, --chunking             Should split the message and publish in chunks if
                               message size is larger than allowed max size
      -db, --disable-batching
                             Disable batch sending of messages
      -dr, --disable-replication
                             Disable geo-replication for messages.
      -ekn, --encryption-key-name=<encKeyName>
                             The public key name to encrypt payload
      -ekv, --encryption-key-value=<encKeyValue>
                             The URI of public key to encrypt payload, for
                               example file:///path/to/public.key or data:
                               application/x-pem-file;base64,*****
  -f, --files=<messageFileNames>
                             Comma separated file paths to send, either -m or
                               -f must be specified.
  -h, --help                 Show this help message and exit.
  -k, --key=<key>            Partitioning key to add to each message
      -ks, --key-schema=<keySchema>
                             Schema type (can be bytes,avro,json,string...)
      -kvet, --key-value-encoding-type=<keyValueEncodingType>
                             Key Value Encoding Type (it can be separated or
                               inline)
      -kvk, --key-value-key=<keyValueKey>
                             Value to add as message key in KeyValue schema
      -kvkf, --key-value-key-file=<keyValueKeyFile>
                             Path to file containing the value to add as
                               message key in KeyValue schema. JSON and AVRO
                               files are supported.
  -m, --messages=<messages>  Messages to send, either -m or -f must be
                               specified. Specify -m for each message.
  -n, --num-produce=<numTimesProduce>
                             Number of times to send message(s), the count of
                               messages/files * num-produce should below than
                               1000.
  -p, --properties=<properties>
                             Properties to add, Comma separated key=value
                               string, like k1=v1,k2=v2.
  -r, --rate=<publishRate>   Rate (in msg/sec) at which to produce, value 0
                               means to produce messages as fast as possible.
  -s, --separator=<separator>
                             Character to split messages string on default is
                               comma
  -v, --version              Print version information and exit.
      -vs, --value-schema=<valueSchema>
                             Schema type (can be bytes,avro,json,string...)

Reproducing the issue

There is two way to reproduce.

1. Reproduce by shell

./bin/pulsar-shell
client produce apache/pulsar/test-topic  -m "hello pulsar"

2. Reproduce by change unit test

  1. just change the unit test line to
linereader.addCmd("client produce -m \"hello pulsar\" my-topic");
  1. run the unit test testInteractiveMode
  2. The ut will fail

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    type/bug
    on May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions