-
1. Re: How to Store a Text File in JMS Queue : setobject
peterj Jan 14, 2009 11:51 AM (in response to waheed)One possibility: Read the file contents into a string and send the string as the message body.
-
2. Re: How to Store a Text File in JMS Queue : setobject
waheed Jan 15, 2009 2:14 PM (in response to waheed)"PeterJ" wrote:
One possibility: Read the file contents into a string and send the string as the message body.
Thnks
I do this
But now i want to write Message in a text file
how it is possible??? -
3. Re: How to Store a Text File in JMS Queue : setobject
waheed Jan 15, 2009 2:15 PM (in response to waheed)"waheed" wrote:
"PeterJ" wrote:
One possibility: Read the file contents into a string and send the string as the message body.
Thnks
I do this
But now i want to write Message in a text file
how it is possible???
Imean read the message from queue and then write in text file????? how's it possible -
4. Re: How to Store a Text File in JMS Queue : setobject
peterj Jan 15, 2009 4:48 PM (in response to waheed)Are you saying that you want to send the java.io.File object in the message so that the receiver can read the file? If so, that is not possible. Nor is it possible to send a java.io.Stream/Writer/whatever. These objects, besides probably not being serializable, do not contain the file contents anyway. And I assume that you are interested in getting the file contents to the receiver. In which case the only option is to read the file contents and send those in the message.
Another option - if both the sender and receiver has visibility to the file, you could just send the full path name. This would work, for instance, in a Windows environment if you used a UNC name (example: \\myhost\sharename\path\to\the\file.txt). -
5. Re: How to Store a Text File in JMS Queue : setobject
peterj Jan 15, 2009 4:53 PM (in response to waheed)Or are you saying that you want the message receiver to write the message contents to a file? If so, then that is a general question about writing text to a file in Java and has nothing to do with messaging. Perhaps use java.io.FileWriter.