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 2022/02/04 10:24:36 UTC

[GitHub] [pulsar] lhotari opened a new pull request #14117: Remove Persistent Topics v3 API - use custom media type instead

lhotari opened a new pull request #14117:
URL: https://github.com/apache/pulsar/pull/14117


   Fixes #14104
   
   ### Motivation
   
   - PR #12818 changes for PIP-110 broke the API. A newer admin client cannot be used with an older broker.
   - It’s possible to have the current v2 API for creating persistent topics to handle multiple different payload types
   The challenge seems to be that in the old method, the number of partitions was passed in the payload as a single integer without having a JSON object at all. This makes it harder to extend the existing API, but doesn’t make it impossible.
   - This solution is based on request’s “Content Type”
   `Content-Type: application/vnd.partitioned-topic-metadata+json` on request, `@Consumes("application/vnd.partitioned-topic-metadata+json")` on method that handles the new payload type.
   
   ### Modifications
   
   - use custom media type `application/vnd.partitioned-topic-metadata+json` to distinguish the new content payload type


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] lhotari commented on a change in pull request #14117: Remove Persistent Topics v3 API - use custom media type instead

Posted by GitBox <gi...@apache.org>.
lhotari commented on a change in pull request #14117:
URL: https://github.com/apache/pulsar/pull/14117#discussion_r799364683



##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -514,8 +514,9 @@ void run() throws PulsarAdminException {
         @Override
         void run() throws Exception {
             String topic = validateTopicName(params);
-            Map<String, String> map = new HashMap<>();
-            if (metadata != null) {
+            Map<String, String> map = null;
+            if (metadata != null && !metadata.isEmpty()) {
+                map = new HashMap<>();

Review comment:
       That is intentional




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #14117: Remove Persistent Topics v3 API - use custom media type instead

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #14117:
URL: https://github.com/apache/pulsar/pull/14117#discussion_r799359121



##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -514,8 +514,9 @@ void run() throws PulsarAdminException {
         @Override
         void run() throws Exception {
             String topic = validateTopicName(params);
-            Map<String, String> map = new HashMap<>();
-            if (metadata != null) {
+            Map<String, String> map = null;
+            if (metadata != null && !metadata.isEmpty()) {
+                map = new HashMap<>();

Review comment:
       Are the changes necessary? It looks like `map`, as the 3rd argument of `Topics#createPartitionedTopic`, is now `null` rather than an empty `HashMap` if `metadata` is empty.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] eolivelli merged pull request #14117: Remove Persistent Topics v3 API - use custom media type instead

Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #14117:
URL: https://github.com/apache/pulsar/pull/14117


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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