coder-zzzz opened a new issue #2441:
URL: https://github.com/apache/rocketmq/issues/2441


   ```java
   class Permission
    public static void parseResourcePerms(PlainAccessResource 
plainAccessResource, Boolean isTopic,
           List<String> resources) {
           if (resources == null || resources.isEmpty()) {
               return;
           }
           for (String resource : resources) {
               String[] items = StringUtils.split(resource, "=");
               if (items.length == 2) {
                   plainAccessResource.addResourceAndPerm(isTopic ? 
items[0].trim() : PlainAccessResource.getRetryTopic(items[0].trim()), 
parsePermFromString(items[1].trim()));
               } else {
                   throw new AclException(String.format("Parse resource 
permission failed for %s:%s", isTopic ? "topic" : "group", resource));
               }
           }
       }
   ```
   There is the sence: producer and consumer are different team, communicate 
each other with topic-a. Consumer only have sub perm of topic-a. When send 
messge back to borker failed , then client will try to direct send msgs to 
retry topic with RequestCode.SEND_MESSAGE(see 
DefaultMQPushConsumerImpl#sendMessageBack). But failed without pub perm.
   
   So I think consumer group should have the pub perm of the retry topic which 
is belong to itself.
   
   ```
   Permission
   public static void parseResourcePerms(PlainAccessResource 
plainAccessResource, Boolean isTopic,
           List<String> resources) {
           if (resources == null || resources.isEmpty()) {
               return;
           }
           //todo: I think can add pub|sub perm of retry group topic to 
consumer group when init 
           for (String resource : resources) {
               String[] items = StringUtils.split(resource, "=");
               if (items.length == 2) {
                  if( isTopic) {
   plainAccessResource.addResourceAndPerm(isTopic ? items[0].trim() : 
PlainAccessResource.getRetryTopic(items[0].trim()), 
parsePermFromString(items[1].trim()));
                  } else {
        plainAccessResource.addResourceAndPerm(retryTopic, (byte) 
(Permission.PUB|Permission.SUB));
   }
                               } else {
                   throw new AclException(String.format("Parse resource 
permission failed for %s:%s", isTopic ? "topic" : "group", resource));
               }
           }
       }
   ```
   
   


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


Reply via email to