How to Create a Component for Apache Camel

Component

import java.util.Map;

import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;

public final class SampleComponent extends DefaultComponent {

  protected Endpoint createEndpoint(final String uri, final String url, final Map params) {`
    return new SampleEndpoint(..., this);
  }

}

Endpoint

import org.apache.camel.Component;
import org.apache.camel.impl.DefaultEndpoint;

public final class SampleEndpoint extends DefaultEndpoint {

  public SampleEndpoint(..., final Component component) {
    setCamelContext(component.getCamelContext());
  }

}

http://camel.apache.org/maven/camel-2.2.0/camel-core/apidocs/org/apache/camel/impl/DefaultEndpoint.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s