You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created my own InflaterPostProcessor class, that is very much like and in the spirit of your existing GUnzipPostProcessor and UnzipPostProcessor classes. The source code for the class is like so:
public static class InflaterPostProcessor extends AbstractDecompressingPostProcessor {
public InflaterPostProcessor() {
}
public InflaterPostProcessor(boolean alwaysDecompress) {
super(alwaysDecompress);
}
protected InputStream getDecompressorStream(InputStream zipped) throws IOException {
return new InflaterInputStream(zipped);
}
protected String getEncoding() {
return "deflate";
}
}
To use this class, I create an instance of it and add it to a DelegatingDecompressingPostProcessor, and set that on my SimpleRabbitListenerContainerFactory (or simply "factory" here):
DelegatingDecompressingPostProcessor postProcessor = new DelegatingDecompressingPostProcessor();
postProcessor.addDecompressor("deflate", new InflaterPostProcessor());
factory.setAfterReceivePostProcessors(postProcessor);
While this certainly isn't much code, I still think it would be nice if guys added this to your codebase. The DelegatingDecompressingPostProcessor class constructor would then change to:
public DelegatingDecompressingPostProcessor() {
this.decompressors.put("gzip", new GUnzipPostProcessor());
this.decompressors.put("zip", new UnzipPostProcessor());
this.decompressors.put("deflate", new InflaterPostProcessor());
}
I'm sure it would also make sense to create an DeflaterPostProcessor class that does the opposite; performs the compression for a message using a DeflaterOutputStream. We currently use a home-grown utility class for doing that, but would gladly switch to using such as class were it to exist in the Spring AMQP library.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
I just submitted the Pull Request to add these classes and related unit tests. This was the first time I ever did anything like this, so please be patient with me if I did something wrong. --Dave
Enhancement
I've created my own InflaterPostProcessor class, that is very much like and in the spirit of your existing GUnzipPostProcessor and UnzipPostProcessor classes. The source code for the class is like so:
To use this class, I create an instance of it and add it to a DelegatingDecompressingPostProcessor, and set that on my SimpleRabbitListenerContainerFactory (or simply "factory" here):
While this certainly isn't much code, I still think it would be nice if guys added this to your codebase. The DelegatingDecompressingPostProcessor class constructor would then change to:
I'm sure it would also make sense to create an DeflaterPostProcessor class that does the opposite; performs the compression for a message using a DeflaterOutputStream. We currently use a home-grown utility class for doing that, but would gladly switch to using such as class were it to exist in the Spring AMQP library.
Thanks in advance.
The text was updated successfully, but these errors were encountered: