JMS publication with large documents

Hi all

I had encountered an issue when publishing a large(~6Mo when converted to XML String) document on the broker. Actually I managed to publish the document but got myself a “java heap space” when trying to receive the JMS Message. The solution I figured out consists in publishing parts of the document as far as it grows, instead of publishing the whole document. Now the question is how can I have an estimation of the size of the part to be published, so that I can compare it with some kind of maximal size and publish it at the right time.


Any idea ?