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.MuleEvent;
10  
11  import java.io.IOException;
12  import java.io.OutputStream;
13  
14  /**
15   * The OutputHandler is a strategy class that is used to defer the writing of the message payload 
16   * until there is a stream available to write it to.
17   */
18  public interface OutputHandler
19  {
20      /**
21       * Write the event payload to the stream. Depending on the underlying transport,
22       * attachements and message properties may be written to the stream here too.
23       * 
24       * @param event the current event
25       * @param out the output stream to write to
26       * @throws IOException in case of error
27       */
28      void write(MuleEvent event, OutputStream out) throws IOException;
29  }