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.spi;
018
019import java.util.List;
020
021import org.apache.camel.StaticService;
022
023/**
024 * A registry which listen for runtime usage of {@link org.apache.camel.Endpoint} during routing in Camel.
025 */
026public interface RuntimeEndpointRegistry extends StaticService {
027
028    /**
029     * Whether gathering runtime usage is enabled or not.
030     */
031    boolean isEnabled();
032
033    /**
034     * Sets whether gathering runtime usage is enabled or not.
035     */
036    void setEnabled(boolean enabled);
037
038    /**
039     * Maximum number of endpoints to keep in the cache per route.
040     * <p/>
041     * The default value is <tt>1000</tt>
042     */
043    int getLimit();
044
045    /**
046     * Sets the maximum number of endpoints to keep in the cache per route.
047     */
048    void setLimit(int limit);
049
050    /**
051     * Clears the runtime usage gathered
052     */
053    void reset();
054
055    /**
056     * Number of endpoints currently in the cache.
057     */
058    int size();
059
060    /**
061     * Gets all the endpoint uris captured during runtime routing that are in-use of the routes.
062     *
063     * @param includeInputs whether to include route inputs
064     */
065    List<String> getAllEndpoints(boolean includeInputs);
066
067    /**
068     * Gets all the endpoint uris captured from the given route during runtime routing that are in-use of the routes.
069     *
070     * @param routeId       the route id
071     * @param includeInputs whether to include route inputs
072     */
073    List<String> getEndpointsPerRoute(String routeId, boolean includeInputs);
074}