-
1. Re: java.io.OptionalDataException
adrian.brock Jul 1, 2003 12:44 PM (in response to delboypass)I don't see any JMS code in your example.
Regards,
Adrian -
2. Re: java.io.OptionalDataException
delboypass Jul 2, 2003 7:31 AM (in response to delboypass)I wasnt planning to use JMS code at this stage.
In the previous message i said i wanted to read in a message as an object as I thought a JMS message would be a serialised object and written out as such but looks as though it is not written out as a serialised object but something else.
I was just wanting to read in a message from outside the JBoss Application server.
We have been having problems restarting the JBoss application server when the queues start to hold above 20,000 messages.The persistence manager takes about 15 minutes to load and the queue takes about 15 minutes as well to initiate. This means that this standalone client will be able to transfer the messages without having to load up the application server first so the application server can start up without anuy messages present in hte queue.
What would the code be to read in a JMS Message from a file.
(Remember that without the JBoss application server running that my queue isnt in JNDI so dont have connectionfactory ect)
If The message isnt a serialised object, then what is it and what is the implementation in JBoss for writing and reading messages (this is what I need to mimic) otherwise how do I change the persistence manager to not take so long on start up.
With our messages we do not need priority, just any message from hte queue will do so no ordering required. -
3. Re: java.io.OptionalDataException
adrian.brock Jul 3, 2003 2:58 AM (in response to delboypass)Assuming you are using the file persistent manager,
there is a long and a byte in front of the message.
The long is the internal messageid, the byte is the
type of message (Map, Stream, Text, etc).
Regards,
Adrian -
4. Re: java.io.OptionalDataException
delboypass Jul 3, 2003 5:15 AM (in response to delboypass)adrian, is there any code that allows me to read in a message object without using JMS.
I how do I get past the long and the byte to get to the message?? -
5. Re: java.io.OptionalDataException
delboypass Jul 3, 2003 6:29 AM (in response to delboypass)try {
FileInputStream fileI = new FileInputStream(sFileName);
ObjectInputStream input = new ObjectInputStream(fileI);
long longtemp = input.readLong();
System.out.println("long: "+longtemp);
byte bytetemp = input.readByte();
System.out.println("byte: "+bytetemp);
obj = input.readObject();
input.close() ;
}
catch (Exception ex) {
Adrian, I have read the long and then the byte but reading the object still throws the java.io.optionalDataException???
Any ideas? -
6. Re: java.io.OptionalDataException
adrian.brock Jul 3, 2003 10:13 AM (in response to delboypass)If you just want to serialize/deseriaize a message
the read/writeObject is the correct way.
Internally jboss does some other tricks for message
pooling that means they are not directly serialized.
For the exact protocol look at the source for persistence
manager you are using.
Regards,
Adrian