fookaiming edited a comment on issue #423:
URL: 
https://github.com/apache/rocketmq-spring/issues/423#issuecomment-1008890638


   The ConsumerA object cannot get its super class correctly, it should also 
loop through its interface 
   ```
       private Type getMessageType() {
           Class<?> targetClass;
           if (rocketMQListener != null) {
               targetClass = 
AopProxyUtils.ultimateTargetClass(rocketMQListener);
           } else {
               targetClass = 
AopProxyUtils.ultimateTargetClass(rocketMQReplyListener);
           }
           Type matchedGenericInterface = null;
           while (Objects.nonNull(targetClass)) {
               Type[] interfaces = targetClass.getGenericInterfaces();
               if (Objects.nonNull(interfaces)) {
                   for (Type type : interfaces) {
                       if (type instanceof ParameterizedType &&
                           (Objects.equals(((ParameterizedType) 
type).getRawType(), RocketMQListener.class) || 
Objects.equals(((ParameterizedType) type).getRawType(), 
RocketMQReplyListener.class))) {
                           matchedGenericInterface = type;
                           break;
                       }
                   }
               }
               targetClass = targetClass.getSuperclass();
           }
           if (Objects.isNull(matchedGenericInterface)) {
               return Object.class;
           }
   
           Type[] actualTypeArguments = ((ParameterizedType) 
matchedGenericInterface).getActualTypeArguments();
           if (Objects.nonNull(actualTypeArguments) && 
actualTypeArguments.length > 0) {
               return actualTypeArguments[0];
           }
           return Object.class;
       }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to