How come we have so many kinds of messages
TextMessage , MapMessage, BytesMessage, StreamMessage
when only an Object message would actually suffice? Bcoz a String, Map, Byte array are ultimately plain simple Java objects.
So why not have only one kind of message and use a typecast?
I think it's mostly to represent some common native types of messages in JMS. Non-Java messaging clients may still be able to read strings, maps, etc if they have some native representation as messages in the messaging system.