jianyun8023 commented on a change in pull request #7738:
URL: https://github.com/apache/pulsar/pull/7738#discussion_r465451441
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
##########
@@ -1032,6 +1032,53 @@ public void removeBacklogQuota(@Suspended final
AsyncResponse asyncResponse, @Pa
internalRemoveBacklogQuota(asyncResponse, backlogQuotaType);
}
+ @GET
+ @Path("/{tenant}/{namespace}/{topic}/messageTTL")
+ @ApiOperation(value = "Get message TTL in seconds for a topic")
+ @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have
admin permission"),
+ @ApiResponse(code = 404, message = "Topic does not
exist"),
+ @ApiResponse(code = 405, message = "Topic level
policy is disabled, enable the topic level policy and retry")})
+ public int getMessageTTL(@PathParam("tenant") String tenant,
+ @PathParam("namespace") String namespace,
+ @PathParam("topic") @Encoded String encodedTopic)
{
+ validateTopicName(tenant, namespace, encodedTopic);
+ return getTopicPolicies(topicName)
+ .map(TopicPolicies::getMessageTTLInSeconds)
+ .orElse(0); //same as default ttl at namespace level
+ }
+
+ @POST
+ @Path("/{tenant}/{namespace}/{topic}/messageTTL")
+ @ApiOperation(value = "Set message TTL in seconds for a topic")
+ @ApiResponses(value = { @ApiResponse(code = 403, message = "Not
authenticate to perform the request or policy is read only"),
+ @ApiResponse(code = 404, message = "Topic does not
exist"),
+ @ApiResponse(code = 405, message = "Topic level
policy is disabled, enable the topic level policy and retry"),
+ @ApiResponse(code = 412, message = "Invalid
message TTL value") })
+ public void setMessageTTL(@Suspended final AsyncResponse asyncResponse,
+ @PathParam("tenant") String tenant,
+ @PathParam("namespace") String namespace,
+ @PathParam("topic") @Encoded String encodedTopic,
+ @ApiParam(value = "TTL in seconds for the
specified namespace", required = true)
+ @QueryParam("messageTTL") int messageTTL) {
+ validateTopicName(tenant, namespace, encodedTopic);
+ internalSetMessageTTL(asyncResponse, messageTTL);
+ }
+
+ @DELETE
+ @Path("/{tenant}/{namespace}/{topic}/messageTTL")
+ @ApiOperation(value = "Set message TTL in seconds for a topic")
Review comment:
Remove message TTL in seconds for a topic
----------------------------------------------------------------
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:
[email protected]