To implement a FUSE Mediation Router component, you must implement the
org.apache.camel.Component
interface. An instance of
Component
type provides the entry point into a custom component. That is, all
of the other objects in a component are ultimately accessible through the
Component
instance. Figure 5.1 shows
the relevant Java interfaces and classes that make up the Component
inheritance
hierarchy.
Example 5.1 shows the definition of the
org.apache.camel.Component
interface.
Example 5.1. Component Interface
package org.apache.camel; public interface Component<E extends Exchange> { CamelContext getCamelContext(); void setCamelContext(CamelContext context); Endpoint<E> createEndpoint(String uri) throws Exception; }
The Component
interface defines the following methods:
getCamelContext()
and
setCamelContext()
—References the
CamelContext
to which this Component
belongs. The setCamelContext()
method is automatically called
when you add the component to a CamelContext
.
createEndpoint()
—The factory method that gets called to
create Endpoint
instances for this component. The uri
parameter is the endpoint URI, which contains the details required to create the endpoint.