JMS message type

G

gk

Its very much confusing that how many type of messages JMS supports .
I have read it can support ObjectMessage , MapMessage , TextMessage ,
ByteMessage,StreamMessage etc . I'm not sure how many are still
there .

Is it true that JMS can support any message type ?Could you please
throw some light on the type of messages.
 
J

Jean-Baptiste Nizet

Do you know the answer of my specific question ? If you want to help ,
could you please post the relevant link instead of the entire API.

I don't understand your post.

It's pretty simple : Java EE defines a number of classes and
interfaces. One of them is the Message interface, used by JMS. If you
have already read about JMS, you should know that. Surprisingly, this
interface is in the package javax.jms. So if you click on the link I
gave you, browse in the upper left frame until you find javax.jms,
click on the link, find the Message interface in the bottom left frame
and click on the link, you'll find the entire documentation for the
javax.jms.Message interface. And surprisingly, the various types of
messages are described in this documentation page.

A bit of googling would have led you to this page as well :
http://download.oracle.com/docs/cd/E17477_01/javaee/5/api/javax/jms/Message..html

If you don't know what RTFM means, then read http://en.wikipedia.org/wiki/RTFM

JB.
 
G

gk

It's pretty simple : Java EE defines a number of classes and
interfaces. One of them is the Message interface, used by JMS. If you
have already read about JMS, you should know that. Surprisingly, this
interface is in the package javax.jms. So if you click on the link I
gave you, browse in the upper left frame until you find javax.jms,
click on the link, find the Message interface in the bottom left frame
and click on the link, you'll find the entire documentation for the
javax.jms.Message interface. And surprisingly, the various types of
messages are described in this documentation page.

A bit of googling would have led you to this page as well :http://download.oracle.com/docs/cd/E17477_01/javaee/5/api/javax/jms/M...

If you don't know what RTFM means, then readhttp://en.wikipedia.org/wiki/RTFM

Ok .I have gone through that material . I found all types of messages
explained there . Thats very nice . I liked that .

However, Could you tell when do we need ByteMessage ? Is it used at
all anywhere ? I see TextMessage , MapMessage,ObjectMessage are quite
useful . these can cover all sorts of requirement I believe.

I don't understand the use of ByteMessage at all . Is it redundant
now ? or Still is in use ?

If could tell me a simple example where this could be of use that will
just wonderful . I did not find any concrete use of this . Could you
please explain this part ?
 
L

Lew

This is a discussion group, not a help desk. People donate their time to
those who request help, for a variety of reasons that all boil down to
generosity. One of the prerequisites for presumption on that generosity is
appreciation for it.

Jean-Baptiste obviously wants to help or he wouldn't have answered. You don't
have the moral high ground to retort with, "If you want to help, ..."

The trick is to understand how his advice helps. I have noticed that you have
a tendency recently to ask questions that are answered in the fundamental
documentation. Nothing will empower you as a programmer more than development
of the ability to obtain your answers from that documentation. Ergo,
Jean-Baptiste's advice is the most helpful anyone will give you on your question.
 
L

Lew

gk said:
I don't understand the use of ByteMessage at all . Is it redundant
now ? or Still is in use ?

From the Javadocs:
"A BytesMessage object's message body contains a stream of uninterpreted
bytes. This message type is for literally encoding a body to match an existing
message format. In many cases, it is possible to use one of the other body
types, which are easier to use. Although the JMS API allows the use of message
properties with byte messages, they are typically not used, since the
inclusion of properties may affect the format."
If could tell me a simple example where this could be of use that will
just wonderful . I did not find any concrete use of this . Could you
please explain this part ?

Whether it's still in use is implicit in that it is not deprecated.

The use case is where you want to send just raw bytes in the message. This is
similar to ByteBuffer in the NIO library. Sometimes it's just more practical
to think of content as a byte stream.
 
G

gk

 From the Javadocs:
"A BytesMessage object's message body contains a stream of uninterpreted
bytes. This message type is for literally encoding a body to match an existing
message format. In many cases, it is possible to use one of the other body
types, which are easier to use. Although theJMSAPI allows the use of message
properties with bytemessages, they are typically not used, since the
inclusion of properties may affect the format."


Whether it's still in use is implicit in that it is not deprecated.

I can understand that. May be they could make it deprecate in later
version (if not in use)!
The use case is where you want to send just raw bytes in the message.  This is
similar to ByteBuffer in the NIO library.  Sometimes it's just more practical
to think of content as a byte stream.

Yes . Thats implicit. ByteMessage itself implies to send just raw
bytes in the message.

What I was asking here is a practical example. Is there any situation
you faced where you used this ?
 
L

Lew

I can understand that. May be they could make it deprecate in later
version (if not in use)!

That's always true, even should it be in use. It seems very unlikely, though.

AFAIK, Java APIs aren't deprecated based on popularity or lack thereof, but on
technical concerns.

Why do you think popularity is relevant to deprecation?
 
A

Arne Vajhøj

However, Could you tell when do we need ByteMessage ? Is it used at
all anywhere ? I see TextMessage , MapMessage,ObjectMessage are quite
useful . these can cover all sorts of requirement I believe.

I don't understand the use of ByteMessage at all . Is it redundant
now ? or Still is in use ?

If could tell me a simple example where this could be of use that will
just wonderful . I did not find any concrete use of this . Could you
please explain this part ?

If the system is Java end to end, then you probably don't need
ByteMessage.

But if the system includes non-Java parts, then sending
binary data which in Java is treated as a byte array
is very common.

My guess is that ByteMessage is used a lot. Sending some
BLOB's through a Java component is done a lot.

Arne
 
G

gk

If the system is Java end to end, then you probably don't need
ByteMessage.

But if the system includes non-Java parts, then sending
binary data which in Java is treated as a byte array
is very common.

Brilliant.....That cleared confusion .

My guess is that ByteMessage is used a lot. Sending some
BLOB's through a Java component is done a lot.

Thanks . I got my answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top