LibraryLink ToToggle FramesPrintFeedback

The Endpoint Interface

An instance of org.apache.camel.Endpoint type encapsulates an endpoint URI, and it also serves as a factory for Consumer, Producer, and Exchange objects. There are three different approaches to implementing an endpoint:

These endpoint implementation patterns complement the corresponding patterns for implementing a consumer—see Implementing the Consumer Interface.

Figure 6.1 shows the relevant Java interfaces and classes that make up the Endpoint inheritance hierarchy.


Example 6.1 shows the definition of the org.apache.camel.Endpoint interface.


The Endpoint interface defines the following methods:

In order to avoid unnecessary overhead, it is a good idea to create a single endpoint instance for all endpoints that have the same URI (within a CamelContext). You can enforce this condition by implementing isSingleton() to return true.

[Note]Note

In this context, same URI means that two URIs are the same when compared using string equality. In principle, it is possible to have two URIs that are equivalent, though represented by different strings. In that case, the URIs would not be treated as the same.