blob: c27d0cbb02570cda9df8891284f578f28f83a966 [file] [log] [blame]
// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-ref"]
= Ref
:page-aliases: extensions/ref.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-ref
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Route messages to an endpoint looked up dynamically by name in the Camel Registry.
:cq-deprecated: false
:cq-jvm-since: 1.0.0
:cq-native-since: 1.0.0
ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.0.0## [.badge-key]##Native since##[.badge-supported]##1.0.0##
endif::[]
Route messages to an endpoint looked up dynamically by name in the Camel Registry.
[id="extensions-ref-whats-inside"]
== What's inside
* xref:{cq-camel-components}::ref-component.adoc[Ref component], URI syntax: `ref:name`
Please refer to the above link for usage and configuration details.
[id="extensions-ref-maven-coordinates"]
== Maven coordinates
https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-ref[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]
Or add the coordinates to your existing project:
[source,xml]
----
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ref</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]
[id="extensions-ref-usage"]
== Usage
CDI producer methods can be harnessed to bind endpoints to the Camel registry, so that they can be resolved
using the `ref` URI scheme in Camel routes.
For example, to produce endpoint beans:
[source,java]
----
@ApplicationScoped
public class MyEndpointProducers {
@Inject
CamelContext context;
@Singleton
@Produces
@Named("endpoint1")
public Endpoint directStart() {
return context.getEndpoint("direct:start");
}
@Singleton
@Produces
@Named("endpoint2")
public Endpoint logEnd() {
return context.getEndpoint("log:end");
}
}
----
Use `ref:` to refer to the names of the CDI beans that were bound to the Camel registry:
[source,java]
----
public class MyRefRoutes extends RouteBuilder {
@Override
public void configure() {
// direct:start -> log:end
from("ref:endpoint1")
.to("ref:endpoint2");
}
}
----