001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.processor.interceptor;
018
019import java.util.Date;
020
021import org.apache.camel.Exchange;
022
023/**
024 * A trace event message that contains decomposed information about the traced
025 * {@link org.apache.camel.Exchange} at the point of interception. The information is stored as snapshot copies
026 * using String types.
027 * <p/>
028 * Notice not all implementations may provide direct access to the traced {@link Exchange} using
029 * the {@link #getTracedExchange()} method, and thus this method may return <tt>null</tt>.
030 * For example the JPA implementation will return <tt>null</tt>.
031 */
032public interface TraceEventMessage {
033
034    /**
035     * Gets the timestamp when the interception occurred
036     */
037    Date getTimestamp();
038
039    /**
040     * Uri of the endpoint that started the {@link org.apache.camel.Exchange} currently being traced.
041     */
042    String getFromEndpointUri();
043
044    /**
045     * Gets the previous node.
046     * <p/>
047     * Will return <tt>null</tt> if this is the first node, then you can use the from endpoint uri
048     * instead to indicate the start
049     */
050    String getPreviousNode();
051
052    /**
053     * Gets the current node that just have been intercepted and processed
054     * <p/>
055     * Is never <tt>null</tt>.
056     */
057    String getToNode();
058
059    String getExchangeId();
060
061    String getRouteId();
062
063    /**
064     * Gets the exchange id without the leading hostname
065     */
066    String getShortExchangeId();
067
068    String getExchangePattern();
069
070    String getProperties();
071
072    String getHeaders();
073
074    String getBody();
075
076    String getBodyType();
077
078    String getOutBody();
079
080    String getOutBodyType();
081
082    String getOutHeaders();
083
084    /**
085     * Gets the caused by exception (ie {@link org.apache.camel.Exchange#getException() Exchange#getException()}.
086     */
087    String getCausedByException();
088
089    /**
090     * Gets the traced {@link Exchange}.
091     * <p/>
092     * Not all implementations may provide direct access to the traced {@link Exchange} and thus this
093     * method may return <tt>null</tt>. For example the JPA implementation will return <tt>null</tt>.
094     *
095     * @return the traced {@link Exchange}, however it can be <tt>null</tt> in some implementations.
096     */
097    Exchange getTracedExchange();
098}