我正在尝试根据此处的相似示例进行消息转换,而我在3.0.4上有类似之处
public MessageXMLDecodeOutInterceptor() {
super(Phase.PRE_STREAM);
}
public void handleMessage(Message message) {
try (OutputStream outStream = message.getContent(OutputStream.class); CachedOutputStream cachedStream = new CachedOutputStream();) {
message.setContent(OutputStream.class, cachedStream);
message.put(Message.ENCODING, charset.name());
message.getInterceptorChain().doIntercept(message);
cachedStream.flush();
String origMessage = IOUtils.toString(cachedStream.getInputStream(), charset);
String newMessage = // modify the message
IOUtils.write(header, outStream, charset);
IOUtils.write(newMessage, outStream, charset);
} catch (IOException e) {
logger.errorf("Could not transform message", e);
}
}
,它一直工作到消息i大(〜200k?),然后突然origMessage是“”。大邮件在某种程度上缓存/处理方式不同吗?
预先感谢, 尼克