2 Replies Latest reply on Sep 3, 2008 4:39 AM by karypid

    XMLMessageFactory exists because...?

      Hi all,

      I want to create my own message class. In reality, my "messages" are XML documents (which may be quite large) and arrive either through file or database gateway listeners. I want to create a composer for each case, which will create a Message object instance that is the same regardless of which gateway the message arrived through.

      I started off with the file gateway and created my composer class by extending LocalFileMessageComposer:

      public class MyMessageComposer extends LocalFileMessageComposer<File> {
       @Override
       public Message compose(File f) throws MessageDeliverException {
       XMLMessageFactory mf = XMLMessageFactory.getInstance();
       Message m = mf.createTextMessage("XML from the file here.");
       return m;
       }
      }


      What does the XMLMessageFactory have to warrant its name? I mean, would it make any difference if I had used the SerializedMessageFactory? As far as understand what I get to work with in each case is a TextBody, like this:

      TextBody messageBody = (TextBody) message.getBody();
      String messageXML = messageBody.getText();


      Am I missing something? I was inclined to look at this class because my messages are XML documents, but it doesn't seem to offer anything...