Suchen

Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 48. Component Interface

download PDF

Abstract

This chapter describes how to implement the Component interface.

48.1. The Component Interface

Overview

To implement a Apache Camel 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 48.1, “Component Inheritance Hierarchy” shows the relevant Java interfaces and classes that make up the Component inheritance hierarchy.

Figure 48.1. Component Inheritance Hierarchy

Component inheritance hierarchy

The Component interface

Example 48.1, “Component Interface” shows the definition of the org.apache.camel.Component interface.

Example 48.1. Component Interface

package org.apache.camel;

public interface Component {
    CamelContext getCamelContext();
    void setCamelContext(CamelContext context);

    Endpoint createEndpoint(String uri) throws Exception;
}

Component methods

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.
Red Hat logoGithubRedditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

© 2024 Red Hat, Inc.