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.cache.responsegenerator;
8   
9   import org.mule.api.MuleEvent;
10  
11  /**
12   * Generates {@link MuleEvent} responses from an request event and a previously
13   * cached response.
14   * <p/>
15   * There is no constraint on the way the response is generated, it could be the
16   * same cached response, or could be a new instance with different properties.
17   */
18  public interface ResponseGenerator
19  {
20  
21      /**
22       * Generates a response event from a request and a cached response for the
23       * request.
24       *
25       * @param request        the request event
26       * @param cachedResponse the cached response for the request
27       * @return a response event generated form the passed information. Could
28       *         be null.
29       */
30      MuleEvent create(MuleEvent request, MuleEvent cachedResponse);
31  }