You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/12/11 09:01:47 UTC

[GitHub] [rocketmq-spring] caimofei opened a new pull request #199: solve the program that rocketMqListener can not support generic param…

caimofei opened a new pull request #199: solve the program that rocketMqListener can not support generic param…
URL: https://github.com/apache/rocketmq-spring/pull/199
 
 
   Problems:
   When definition the listener like this. the starter cannot settup
   `public class Listener1 implements RocketMQListener<MsgDto<String>>`
   
   Recently, I tryied solve this problem,only modify the DefaultRocketMQListenerContainer class. Wish to improve the starter in next release.
   
   1. My Main idea is use org.springframework.messaging.converter.SmartMessageConverter#fromMessage .This interface define a third parameter called "Object conversionHint".
   2. switch the Definition of DefaultRocketMQListenerContainer#messageType to Type insteadof Class
   3. add a "private MethodParameter onMessageParameter" member to DefaultRocketMQListenerContainer and init it to indicate the onMessage parameter when afterPropertiesSet()
   4. when doCovertMessage. if the messageType instanceof ParameterizedType, then call fromMessage with the third parameter(methodParameter). The MappingJackson2MessageConverter can use it to deserialization the message.

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


With regards,
Apache Git Services