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.Map;
020
021import org.apache.camel.CamelContext;
022import org.apache.camel.Consumer;
023import org.apache.camel.Processor;
024
025/**
026 * Allows SPI to plugin a {@link RestConsumerFactory} that creates the Camel {@link Consumer} responsible
027 * for handling incoming HTTP requests from clients that request to access REST services which has been created using
028 * the <a href="http://camel.apache.org/rest-dsl">rest-dsl</a>.
029 *
030 * @see RestApiConsumerFactory
031 * @see RestApiProcessorFactory
032 */
033public interface RestConsumerFactory {
034
035    /**
036     * Creates a new REST <a
037     * href="http://camel.apache.org/event-driven-consumer.html">Event
038     * Driven Consumer</a>, which consumes messages from the endpoint using the given processor
039     *
040     * @param camelContext  the camel context
041     * @param processor     the processor
042     * @param verb          HTTP verb such as GET, POST
043     * @param basePath      base path
044     * @param uriTemplate   uri template
045     * @param consumes      media-types for what this REST service consume as input (accept-type), is <tt>null</tt> or <tt>&#42;/&#42;</tt> for anything
046     * @param produces      media-types for what this REST service produces as output, can be <tt>null</tt>
047     * @param configuration REST configuration
048     * @param parameters    additional parameters
049     * @return a newly created REST consumer
050     * @throws Exception can be thrown
051     */
052    Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
053                            String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception;
054}