| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| Endpoint |
|
| 0.0;0 |
| 1 | /* |
|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
|
| 4 | * this work for additional information regarding copyright ownership. |
|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
| 6 | * (the "License"); you may not use this file except in compliance with |
|
| 7 | * the License. You may obtain a copy of the License at |
|
| 8 | * |
|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 10 | * |
|
| 11 | * Unless required by applicable law or agreed to in writing, software |
|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 14 | * See the License for the specific language governing permissions and |
|
| 15 | * limitations under the License. |
|
| 16 | */ |
|
| 17 | package org.apache.camel; |
|
| 18 | ||
| 19 | ||
| 20 | /** |
|
| 21 | * An <a href="http://activemq.apache.org/camel/endpoint.html">endpoint</a> implements the |
|
| 22 | * <a href="http://activemq.apache.org/camel/message-endpoint.html">Message Endpoint</a> |
|
| 23 | * pattern and represents an endpoint that can send and receive message exchanges |
|
| 24 | * |
|
| 25 | * @see Exchange, Message |
|
| 26 | * @version $Revision: 541693 $ |
|
| 27 | */ |
|
| 28 | public interface Endpoint<E extends Exchange> { |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Returns if the endpoint should be a CamelContext singleton. If the endpoint is a Singleton, |
|
| 32 | * then a single Endpoint instance will be shared by all routes with the same URI. Because the endpoint |
|
| 33 | * is shared, it should be treated as an immutable. |
|
| 34 | */ |
|
| 35 | boolean isSingleton(); |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Returns the string representation of the endpoint URI |
|
| 39 | */ |
|
| 40 | String getEndpointUri(); |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Create a new exchange for communicating with this endpoint |
|
| 44 | */ |
|
| 45 | E createExchange(); |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Creates a new exchange for communicating with this exchange using the given exchange to pre-populate the values |
|
| 49 | * of the headers and messages |
|
| 50 | */ |
|
| 51 | E createExchange(Exchange exchange); |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Converts the given exchange to this endpoints required type |
|
| 55 | */ |
|
| 56 | E toExchangeType(Exchange exchange); |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Returns the context which created the endpoint |
|
| 60 | * |
|
| 61 | * @return the context which created the endpoint |
|
| 62 | */ |
|
| 63 | CamelContext getContext(); |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Creates a new producer which is used send messages into the endpoint |
|
| 67 | * |
|
| 68 | * @return a newly created producer |
|
| 69 | */ |
|
| 70 | Producer<E> createProducer() throws Exception; |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Creates a new <a href="http://activemq.apache.org/camel/event-driven-consumer.html">Event Driven Consumer</a> |
|
| 74 | * which consumes messages from the endpoint using the given processor |
|
| 75 | * |
|
| 76 | * @return a newly created consumer |
|
| 77 | */ |
|
| 78 | Consumer<E> createConsumer(Processor processor) throws Exception; |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Creates a new <a href="http://activemq.apache.org/camel/polling-consumer.html">Polling Consumer</a> |
|
| 82 | * so that the caller can poll message exchanges from the consumer |
|
| 83 | * using {@link PollingConsumer#receive()}, {@link PollingConsumer#receiveNoWait()} or {@link PollingConsumer#receive(long)} |
|
| 84 | * whenever it is ready to do so rather than using the |
|
| 85 | * <a href="http://activemq.apache.org/camel/event-driven-consumer.html">Event Based Consumer</a> |
|
| 86 | * returned by {@link #createConsumer(Processor)} |
|
| 87 | * |
|
| 88 | * @return a newly created pull consumer |
|
| 89 | * @throws Exception if the pull consumer could not be created |
|
| 90 | */ |
|
| 91 | PollingConsumer<E> createPollingConsumer() throws Exception; |
|
| 92 | } |