View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.api.transport;
8   
9   import org.mule.api.MuleMessage;
10  
11  /**
12   * <code>MuleMessageFactory</code> is a factory for creating a {@link MuleMessage} from a transport's
13   * native message format (e.g. JMS message).
14   */
15  public interface MuleMessageFactory
16  {
17      /**
18       * Creates a {@link MuleMessage} instance from <code>transportMessage</code> by extracting
19       * its payload and, if available, any relevant message properties and attachments.
20       */
21      MuleMessage create(Object transportMessage, String encoding) throws Exception;
22  
23      /**
24       * Creates a {@link MuleMessage} instance by extracting the payload from 
25       * <code>transportMessage</code>. Additional message properties will be taken from
26       * <code>previousMessage</code>.
27       */
28      MuleMessage create(Object transportMessage, MuleMessage previousMessage, String encoding)
29          throws Exception;
30  }