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 | * An <a href="http://activemq.apache.org/camel/endpoint.html">endpoint</a> |
|
21 | * implements the <a |
|
22 | * href="http://activemq.apache.org/camel/message-endpoint.html">Message |
|
23 | * Endpoint</a> pattern and represents an endpoint that can send and receive |
|
24 | * message exchanges |
|
25 | * |
|
26 | * @see Exchange, Message |
|
27 | * @version $Revision: 563607 $ |
|
28 | */ |
|
29 | public interface Endpoint<E extends Exchange> { |
|
30 | ||
31 | /** |
|
32 | * Returns if the endpoint should be a CamelContext singleton. If the |
|
33 | * endpoint is a Singleton, then a single Endpoint instance will be shared |
|
34 | * by all routes with the same URI. Because the endpoint is shared, it |
|
35 | * should be treated as an immutable. |
|
36 | */ |
|
37 | boolean isSingleton(); |
|
38 | ||
39 | /** |
|
40 | * Returns the string representation of the endpoint URI |
|
41 | */ |
|
42 | String getEndpointUri(); |
|
43 | ||
44 | /** |
|
45 | * Create a new exchange for communicating with this endpoint |
|
46 | */ |
|
47 | E createExchange(); |
|
48 | ||
49 | /** |
|
50 | * Creates a new exchange for communicating with this exchange using the |
|
51 | * given exchange to pre-populate the values of the headers and messages |
|
52 | */ |
|
53 | E createExchange(Exchange exchange); |
|
54 | ||
55 | /** |
|
56 | * Converts the given exchange to this endpoints required type |
|
57 | */ |
|
58 | E toExchangeType(Exchange exchange); |
|
59 | ||
60 | /** |
|
61 | * Returns the context which created the endpoint |
|
62 | * |
|
63 | * @return the context which created the endpoint |
|
64 | */ |
|
65 | CamelContext getContext(); |
|
66 | ||
67 | /** |
|
68 | * Creates a new producer which is used send messages into the endpoint |
|
69 | * |
|
70 | * @return a newly created producer |
|
71 | */ |
|
72 | Producer<E> createProducer() throws Exception; |
|
73 | ||
74 | /** |
|
75 | * Creates a new <a |
|
76 | * href="http://activemq.apache.org/camel/event-driven-consumer.html">Event |
|
77 | * Driven Consumer</a> which consumes messages from the endpoint using the |
|
78 | * given processor |
|
79 | * |
|
80 | * @return a newly created consumer |
|
81 | */ |
|
82 | Consumer<E> createConsumer(Processor processor) throws Exception; |
|
83 | ||
84 | /** |
|
85 | * Creates a new <a |
|
86 | * href="http://activemq.apache.org/camel/polling-consumer.html">Polling |
|
87 | * Consumer</a> so that the caller can poll message exchanges from the |
|
88 | * consumer using {@link PollingConsumer#receive()}, |
|
89 | * {@link PollingConsumer#receiveNoWait()} or |
|
90 | * {@link PollingConsumer#receive(long)} whenever it is ready to do so |
|
91 | * rather than using the <a |
|
92 | * href="http://activemq.apache.org/camel/event-driven-consumer.html">Event |
|
93 | * Based Consumer</a> returned by {@link #createConsumer(Processor)} |
|
94 | * |
|
95 | * @return a newly created pull consumer |
|
96 | * @throws Exception if the pull consumer could not be created |
|
97 | */ |
|
98 | PollingConsumer<E> createPollingConsumer() throws Exception; |
|
99 | } |