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 org.apache.camel.Exchange;
020import org.apache.camel.Processor;
021import org.apache.camel.model.ProcessorDefinition;
022
023/**
024 * A handler which reacts on trace events.
025 */
026@Deprecated
027public interface TraceEventHandler {
028
029    /**
030     * Event called when an {@link Exchange} is about to be processed
031     * <p/>
032     * This event is only called if trace out has been disabled (which it is by default).
033     * <p/>
034     * This method is for coarse grained tracing, where as the other two methods is for fine grained
035     * with in and event events.
036     *
037     * @param node             the current node
038     * @param target           the current processor being invoked
039     * @param traceInterceptor the trace interceptor
040     * @param exchange         the current exchange
041     * @throws Exception is thrown if an error occurred during tracing
042     */
043    void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception;
044
045    /**
046     * Event called when an {@link Exchange} is about to be processed (in)
047     * <p/>
048     * This event is only called if trace out has been enabled.
049     *
050     * @param node             the current node
051     * @param target           the current processor being invoked
052     * @param traceInterceptor the trace interceptor
053     * @param exchange         the current exchange
054     * @return an optional return object to pass in the <tt>traceEventOut</tt> method.
055     * @throws Exception is thrown if an error occurred during tracing
056     */
057    Object traceExchangeIn(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception;
058
059    /**
060     * Event called when an {@link Exchange} has been processed (out)
061     * <p/>
062     * This event is only called if trace out has been enabled.
063     *
064     * @param node             the current node
065     * @param target           the current processor being invoked
066     * @param traceInterceptor the trace interceptor
067     * @param exchange         the current exchange (contains exception if the processing failed with an exception)
068     * @param traceState       the optional object which was returned from the <tt>traceEventIn</tt> method.
069     * @throws Exception is thrown if an error occurred during tracing
070     */
071    void traceExchangeOut(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception;
072
073}