compilant old broker message body string
@@ -60,6 +60,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Arrays;
@@ -281,7 +282,17 @@ public class BrokerMessageServiceImpl implements BrokerMessageService {
message.setStoreTime(m.getStoreTime());
message.setBusinessId(m.getBusinessId());
if(m.getBody()!=null) {
+ try {
message.setBody(messagePreviewService.preview(messageDecodeType,Base64.getDecoder().decode(m.getBody())));
+ }catch(Throwable e){
+ if(logger.isDebugEnabled()) {
+ logger.debug("may old broker", e);
+ }
+ if(m.getBody()!=null) {
+ message.setBody(messagePreviewService.preview(messageDecodeType, m.getBody().getBytes(Charset.forName("utf-8"))));
+ }
+ }
+
}
message.setAttributes(m.getAttributes());
message.setFlag(m.isAck());
