You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/07/30 21:44:53 UTC

[GitHub] [pulsar] devinbost opened a new pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

devinbost opened a new pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704


   ### Motivation
   The current options for producing messages via the pulsar-client producer do not easily allow the publishing of JSON objects. The default separator (a comma) splits the JSON object into malformed parts when more than one key/value pair is provided. It is possible to change the default separator to a substring that is unlikely to be found, but for large messages, there is no guarantee that the substring won't exist in the message. Moreover, for new users who might not be aware that they can change the default separator, it can be difficult and confusing for them when they have trouble determining how to publish the JSON object. Publishing a JSON object is very common, so this feature is much needed. 
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
   
   ### Modifications
   
   I added an additional parameter to allow passing the JSON object as a string. I considered adding support for passing multiple JSON objects, but that gets more complex to implement and may be unnecessary because most users can either create a script with multiple lines with inline JSON messages to produce repeatedly, or they can add an object splitter function or producer/consumer to split an array of JSON objects into single JSON objects for a downstream consumer. I chose to add the additional parameter (--json or -j) instead of modifying the existing contract for passing messages (via --message or -m) to ensure backwards compatability.  
   
   ### Verifying this change
   
   I ran into an environment-specific build issue that requires a dependency to be added to my repo mirror, so I was unable to run tests locally and wanted to get the PR created to get feedback on the approach before going further. 
   
   I also didn't see any unit tests for producing messages via the CLI, so I'd like guidance on how that should be approached or if these changes are trivial enough that they don't require testing. 
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies: (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - **The admin cli options: (yes)**
     - Anything that affects deployment: (don't know)
   
   ### Documentation
   
     - Does this pull request introduce a new feature? **(yes)**
     - If yes, how is the feature documented? 
   
   I updated documentation in a couple of places to document the new feature, but I may have missed some places, so feedback on what other pages need to be updated would be helpful.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-675046163


   @aahmed-se maybe you can take a look? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-673255927


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost closed pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost closed pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-668007472


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-666943704


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-675110543


   @sijie JSON objects are passed as strings in this PR. In my description, I explained that it's currently not possible to do this with the CLI due to the string splitting issue that I described, which makes it harder to write scripts and test automation that uses the CLI. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-673932501


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-666776299


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-673090585


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-674307710


   @sijie @merlimat I'm ready for a review on this PR. Maybe someone can be assigned to it? It doesn't look like it will let me assign reviewers. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-673752902


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
sijie commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-675159062


   I don't suggest adding a new option. I was suggesting instead of adding a new option just re-using existing option (i.e. if people provide an empty separate, that means the separator is disabled).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-666908310


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-675151859


   @sijie You're suggesting that we add a boolean parameter to disable string splitting so we can use the existing message parameter to pass the string instead of introducing a new option? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
sijie commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-675112667


   @devinbost 
   
   You can use "-f" to specify the content to produce. 
   
   We can improve the tool to disable separator to allow user passing in the whole string as the message payload, instead of introducing a new option.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-674292751


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] devinbost commented on pull request #7704: [Issue #7660] [pulsar-cli] Add support for producing JSON object via Pulsar Client CLI

Posted by GitBox <gi...@apache.org>.
devinbost commented on pull request #7704:
URL: https://github.com/apache/pulsar/pull/7704#issuecomment-673886358


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org