You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "gepengjun (via GitHub)" <gi...@apache.org> on 2023/03/02 07:50:17 UTC

[GitHub] [rocketmq-spring] gepengjun opened a new pull request, #534: change MessageConverter.fromMessage()'s parameter Type from String to byte[]

gepengjun opened a new pull request, #534:
URL: https://github.com/apache/rocketmq-spring/pull/534

   
   ## What is the purpose of the change
   i think byte[] is more suitable for the most MessageConverter than String, byte[] is suitable the current MessageConverters such as  
   ByteArrayMessageConverter, StringMessageConverter, MappingJackson2MessageConverter, MappingFastJsonMessageConverter,
   and it is yet suitable for ProtobufMessageConverter;
   


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq-spring] gepengjun commented on pull request #534: change MessageConverter.fromMessage()'s parameter Type from String to byte[]

Posted by "gepengjun (via GitHub)" <gi...@apache.org>.
gepengjun commented on PR #534:
URL: https://github.com/apache/rocketmq-spring/pull/534#issuecomment-1451437791

   i want to serialize and deserialize the message  with ProtobufMessageConverter so i define RocketMQMessageConverter like this
    @Bean
       public RocketMQMessageConverter  rocketMQMessageConverter(ProtobufMessageConverter protobufMessageConverter){
           RocketMQMessageConverter rocketMQMessageConverter = new RocketMQMessageConverter();
           CompositeMessageConverter messageConverter = (CompositeMessageConverter)rocketMQMessageConverter.getMessageConverter();
           messageConverter.getConverters().add(0, protobufMessageConverter);
           return rocketMQMessageConverter;
       }
    but an exception occured:
     Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class [B (java.lang.String and [B are in module java.base of loader 'bootstrap')
   	at org.springframework.messaging.converter.ProtobufMessageConverter.convertFromInternal(ProtobufMessageConverter.java:147) ~[spring-messaging-5.2.8.RELEASE.jar:5.2.8.RELEASE]


-- 
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@rocketmq.apache.org

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