There are 2 possibilities, but generally speaking the main idea is to compress data:
- compress message: suggested by oracle
- compress TableSpace; not suggetsed by Oracle
then let me suggest the first solution; then, you can enable weblogic compression or your custom compression on producer and consumer.
Weblogic compression
Navigate to JMS Connection Factory -> Click the Configuration >
Default Delivery tab. On the Default Delivery page -> Default
Compression Threshold
Custom GZIP Compression
- compress xml message before sending
- uncompress when you receive
for instance I use the following code on MDB to extract text if the producer compressed message or not;
protected String getText(Message message) throws JMSException, IOException {
if (message instanceof TextMessage) {
return ((TextMessage) message).getText();
} else if (message instanceof BytesMessage) {
byte zipped[] = new byte[(int) ((BytesMessage) message)
.getBodyLength()];
((BytesMessage) message).readBytes(zipped);
ByteArrayInputStream bais = new ByteArrayInputStream(zipped);
StringBuilder sb = null;
GZIPInputStream in = null;
try {
in = new GZIPInputStream(bais);
BufferedReader reader = new BufferedReader(
new InputStreamReader(in));
sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} finally {
try {
if (in != null)
in.close();
} catch (IOException e) {
log.error("getText: ", e);
}
try {
if (bais != null)
bais.close();
} catch (IOException e) {
log.error("getText: ", e);
}
}
return sb.toString();
} else {
throw new JMSException("Unrecognized message type "
+ message.getClass());
}
}
Custom EXI Compression
Recently I evalued the Efficient XML Interchange (EXI) Format 1.0.
Here the indicators:
- original message: 8903B
- gzipped message: 1212B
- exi schemaless: 903B
- exi with schema: 856B
but the only java open source implementation is the exi proxessor proposed by siemens