|
|
|
@ -20,7 +20,12 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.springframework.messaging.Message;
|
|
|
|
|
import org.springframework.messaging.converter.*;
|
|
|
|
|
import org.springframework.messaging.converter.AbstractMessageConverter;
|
|
|
|
|
import org.springframework.messaging.converter.ByteArrayMessageConverter;
|
|
|
|
|
import org.springframework.messaging.converter.CompositeMessageConverter;
|
|
|
|
|
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
|
|
|
|
import org.springframework.messaging.converter.MessageConverter;
|
|
|
|
|
import org.springframework.messaging.converter.StringMessageConverter;
|
|
|
|
|
import org.springframework.util.ClassUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -95,22 +100,25 @@ public class RocketMQMessageConverter extends AbstractMessageConverter {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Convert the message payload from serialized form to an Object by RocketMQMessageConverter.
|
|
|
|
|
* Convert the message payload from serialized form to an Object by
|
|
|
|
|
* RocketMQMessageConverter.
|
|
|
|
|
* @param message the input message
|
|
|
|
|
* @param targetClass the target class for the conversion
|
|
|
|
|
* @param conversionHint an extra object passed to the {@link MessageConverter},
|
|
|
|
|
* e.g. the associated {@code MethodParameter} (may be {@code null}}
|
|
|
|
|
* @param conversionHint an extra object passed to the {@link MessageConverter}, e.g.
|
|
|
|
|
* the associated {@code MethodParameter} (may be {@code null}}
|
|
|
|
|
* @return the result of the conversion, or {@code null} if the converter cannot
|
|
|
|
|
* perform the conversion
|
|
|
|
|
* @since 4.2
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
|
|
|
|
|
protected Object convertFromInternal(Message<?> message, Class<?> targetClass,
|
|
|
|
|
Object conversionHint) {
|
|
|
|
|
Object payload = null;
|
|
|
|
|
for (MessageConverter converter : getMessageConverter().getConverters()) {
|
|
|
|
|
try {
|
|
|
|
|
payload = converter.fromMessage(message, targetClass);
|
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ignore) {
|
|
|
|
|
}
|
|
|
|
|
if (payload != null) {
|
|
|
|
|
return payload;
|
|
|
|
@ -122,5 +130,4 @@ public class RocketMQMessageConverter extends AbstractMessageConverter {
|
|
|
|
|
return payload;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|