concept Camel endpoint in category camel

appears as: Camel endpoint, Camel endpoints, Camel endpoint, Camel endpoints
Camel in Action

This is an excerpt from Manning's book Camel in Action.

You’ve heard the Camel registry mentioned a few times now but haven’t seen it in use. We don’t dive into detail about the registry here (that’s covered in chapter 4), but we’ll show a common syntax in endpoint URIs related to the registry. Anytime a Camel endpoint requires an object instance as an option value, you can refer to one in the registry by using the # syntax. For example, say you want to fetch only CSV order files from the FTP site. You could define a filter like so:

The camel-cdi component provides a specialized dependency injection to inject Camel endpoints in POJOs.

Using @Uri to inject Camel endpoint

In your POJOs or Camel routes, you may want to inject a Camel endpoint. For example, instead of using string values for Camel endpoints in Camel routes, you can use endpoint instances instead:

@Singleton public class HelloRoute extends RouteBuilder { @Inject private HelloBean hello; @Inject @Uri("jetty:http://localhost:8080/hello")     #1 private Endpoint jetty; public void configure() throws Exception { from(jetty)     #2 .bean(hello, "sayHello"); } } #1 Dependency injects Camel endpoint with the given URI #2 Uses the injected Camel endpoint in the Camel route

In the HelloRoute class, we use a field to define the Camel endpoint for the incoming endpoint ❶. Notice that the field is annotated with both @Inject (CDI) and @Uri (camel-cdi). In the Camel route, the endpoint is used in the form that accepts org.apache.camel.Endpoint as a parameter type ❷.

Figure 19.3 Editing the Camel endpoint in a type-safe manner using the tooling. Documentation is available for every option as tooltips. The screenshot shows the extensive documentation for the read lock option.

c19_03.png
Camel in Action

This is an excerpt from Manning's book Camel in Action.

  • PublishEventNotifier—A notifier for dispatching the event to any kind of Camel endpoint. This allows you to leverage Camel transports to broadcast the message any way you want.
  • Implementing consumer actors for receiving messages from Camel endpoints
  • Implementing producer actors for sending messages to Camel endpoints