All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.camel.spi.Debugger Maven / Gradle / Ivy

There is a newer version: 4.6.0
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.spi;

import java.util.EventObject;
import java.util.List;

import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Service;
import org.apache.camel.model.ProcessorDefinition;

/**
 * A debugger which allows tooling to attach breakpoints which is is being invoked
 * when {@link Exchange}s is being routed.
 *
 * @version 
 */
public interface Debugger extends Service, CamelContextAware {

    /**
     * Add the given breakpoint
     *
     * @param breakpoint the breakpoint
     */
    void addBreakpoint(Breakpoint breakpoint);

    /**
     * Add the given breakpoint
     *
     * @param breakpoint the breakpoint
     * @param conditions a number of {@link org.apache.camel.spi.Condition}s
     */
    void addBreakpoint(Breakpoint breakpoint, Condition... conditions);

    /**
     * Add the given breakpoint which will be used in single step mode
     * 

* The debugger will single step the first message arriving. * * @param breakpoint the breakpoint */ void addSingleStepBreakpoint(Breakpoint breakpoint); /** * Add the given breakpoint which will be used in single step mode *

* The debugger will single step the first message arriving. * * @param breakpoint the breakpoint * @param conditions a number of {@link org.apache.camel.spi.Condition}s */ void addSingleStepBreakpoint(Breakpoint breakpoint, Condition... conditions); /** * Removes the given breakpoint * * @param breakpoint the breakpoint */ void removeBreakpoint(Breakpoint breakpoint); /** * Suspends all breakpoints. */ void suspendAllBreakpoints(); /** * Activate all breakpoints. */ void activateAllBreakpoints(); /** * Gets a list of all the breakpoints * * @return the breakpoints wrapped in an unmodifiable list, is never null. */ List getBreakpoints(); /** * Starts the single step debug mode for the given exchange * * @param exchangeId the exchange id * @param breakpoint the breakpoint * @return true if the debugger will single step the given exchange, false if the debugger is already * single stepping another, and thus cannot simultaneously single step another exchange */ boolean startSingleStepExchange(String exchangeId, Breakpoint breakpoint); /** * Stops the single step debug mode for the given exchange. *

* Notice: The default implementation of the debugger is capable of auto stopping when the exchange is complete. * * @param exchangeId the exchange id */ void stopSingleStepExchange(String exchangeId); /** * Callback invoked when an {@link Exchange} is about to be processed which allows implementators * to notify breakpoints. * * @param exchange the exchange * @param processor the {@link Processor} about to be processed * @param definition the definition of the processor * @return true if any breakpoint was hit, false if not breakpoint was hit */ boolean beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition); /** * Callback invoked when an {@link Exchange} has been processed which allows implementators * to notify breakpoints. * * @param exchange the exchange * @param processor the {@link Processor} which was processed * @param definition the definition of the processor * @param timeTaken time in millis it took to process the {@link Exchange} - time spend in breakpoint callbacks may affect this time * @return true if any breakpoint was hit, false if not breakpoint was hit */ boolean afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken); /** * Callback invoked when an {@link Exchange} is being processed which allows implementators * to notify breakpoints. * * @param exchange the exchange * @param event the event (instance of {@link org.apache.camel.management.event.AbstractExchangeEvent} * @return true if any breakpoint was hit, false if not breakpoint was hit */ boolean onEvent(Exchange exchange, EventObject event); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy