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.routing;
8   
9   import org.mule.api.routing.MessageInfoMapping;
10  import org.mule.api.MuleMessage;
11  
12  /**
13   * A simple facade implementation of {@link org.mule.api.routing.MessageInfoMapping} that simply
14   * grabs the message information from the {@link org.mule.api.MuleMessage} untouched.
15   */
16  public class MuleMessageInfoMapping implements MessageInfoMapping
17  {
18      public String getCorrelationId(MuleMessage message)
19      {
20          String id= message.getCorrelationId();
21          if (id == null)
22          {
23              id = getMessageId(message);
24          }
25          return id;
26      }
27  
28      public String getMessageId(MuleMessage message)
29      {
30          return message.getUniqueId();
31      }
32  }