List of usage examples for org.springframework.amqp.core MessageProperties SPRING_AUTO_DECOMPRESS
String SPRING_AUTO_DECOMPRESS
To view the source code for org.springframework.amqp.core MessageProperties SPRING_AUTO_DECOMPRESS.
Click Source Link
From source file:org.springframework.amqp.support.postprocessor.AbstractCompressingPostProcessor.java
@Override public Message postProcessMessage(Message message) throws AmqpException { ByteArrayOutputStream zipped = new ByteArrayOutputStream(); try {/*from www .j av a2s . c o m*/ OutputStream zipper = getCompressorStream(zipped); FileCopyUtils.copy(new ByteArrayInputStream(message.getBody()), zipper); MessageProperties messageProperties = message.getMessageProperties(); String currentEncoding = messageProperties.getContentEncoding(); messageProperties .setContentEncoding(getEncoding() + (currentEncoding == null ? "" : ":" + currentEncoding)); if (this.autoDecompress) { messageProperties.setHeader(MessageProperties.SPRING_AUTO_DECOMPRESS, true); } byte[] compressed = zipped.toByteArray(); if (this.logger.isTraceEnabled()) { this.logger.trace("Compressed " + message.getBody().length + " to " + compressed.length); } return new Message(compressed, messageProperties); } catch (IOException e) { throw new AmqpIOException(e); } }