6

The main question doesn't give the idea of the problem, so here I am explaining it.

The task is to divide the objects belonging to a family (based on some relationship) and passing them as JMS messages for a process to act upon. All in the family should be processed together.

Now the family group can get bigger. so the question. Is there any other approach which will not have the issue which I have listed.

Rig Veda
  • 801
  • 2
  • 10
  • 17

2 Answers2

13

Theoretically the message size is limited by JVM heap size only. But I do not think it is a good practice to send too big messages. I'd say if your message is bigger than 10K, re-think your design.

If you really have to send a lot of data with your message probably better solution is to store data in DB and send ID of the main entity with the message, so the other side will be able to retrieve data it needs.

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • +1: I would use network accessible files e.g. NFS or Windows share, for really large data e.g. GBs. – Peter Lawrey Mar 11 '12 at 10:22
  • @AlexR: I too have the same question as the OP. I just need a clarification about your comment. In case if the `other side` is a *different system*, how it will retrieve the data that is stored as `ID` in the DB? – Gnanam Oct 22 '12 at 13:28
  • Can you give a reference why messages bigger than 10K justify the additional complexity of a side channel? – Markus Malkusch Mar 30 '16 at 12:35
  • 1
    Message is sent as serializable java object. Serialization of big message takes time. Big message eats its part of the JVM heap. If JMS destination is persisted the message is not just serialized/deserialized (probably even twice) but also is stored in generic DB and then is retrieved from it that takes more time and requires more CPU than retrieving the same data from specialized DB schema. – AlexR Mar 31 '16 at 06:29
1

Actually there isn't any limitation size of Object Message in JMS. JMS is API and if its implementation have to decid fro this issue.

for more information see this question/answer: JMS message size

Community
  • 1
  • 1
Sam
  • 6,770
  • 7
  • 50
  • 91