gnodet-bot commented on code in PR #30284:
URL: https://github.com/apache/camel/pull/30284#discussion_r4601231813


##########
components/camel-direct/src/main/docs/direct-component.adoc:
##########
@@ -41,6 +41,51 @@ include::partial$component-endpoint-options.adoc[]
 include::partial$component-endpoint-headers.adoc[]
 // component options: END
 
+== Usage
+
+The route that consumes from a direct endpoint runs in the thread of the 
producer, and the producer continues with the
+message as that route leaves it.
+A direct endpoint is therefore called like a method: from Java code, call a 
route with `requestBody` of a
+xref:manual::producertemplate.adoc[ProducerTemplate] to get its reply:
+
+[source,java]
+----
+String reply = template.requestBody("direct:processOrder", order, 
String.class);
+----
+
+=== One route per endpoint
+
+Only one route can consume from a direct endpoint.
+A second route that consumes from the same endpoint fails to start with
+`Multiple consumers for the same endpoint is not allowed: 
direct://processOrder`.
+To send a message to several routes, use the 
xref:eips:multicast-eip.adoc[Multicast] or
+xref:eips:recipientList-eip.adoc[Recipient List] EIP, or the 
xref:seda-component.adoc[SEDA] component with
+`multipleConsumers=true`.
+
+=== When no route consumes from the endpoint
+
+When no started route consumes from the endpoint, the producer waits up to 
`timeout` milliseconds (30 seconds by
+default) for one to start, for example while Camel starts or reloads routes.
+Then the exchange fails with `DirectConsumerNotAvailableException`.
+Its message starts with `No consumers available on endpoint:`, and says which 
route consumes from the endpoint and its
+status, or that no route does (with a close endpoint name when there is one), 
and how long the producer waited.

Review Comment:
   💬 **Nit:** "a close endpoint name" reads a bit oddly — "a similar endpoint 
name" would be clearer here.
   
   ```suggestion
   status, or that no route does (with a similar endpoint name when there is 
one), and how long the producer waited.
   ```



##########
components/camel-direct/src/main/docs/direct-component.adoc:
##########
@@ -41,6 +41,51 @@ include::partial$component-endpoint-options.adoc[]
 include::partial$component-endpoint-headers.adoc[]
 // component options: END
 
+== Usage
+
+The route that consumes from a direct endpoint runs in the thread of the 
producer, and the producer continues with the
+message as that route leaves it.
+A direct endpoint is therefore called like a method: from Java code, call a 
route with `requestBody` of a
+xref:manual::producertemplate.adoc[ProducerTemplate] to get its reply:
+
+[source,java]
+----
+String reply = template.requestBody("direct:processOrder", order, 
String.class);
+----
+
+=== One route per endpoint
+
+Only one route can consume from a direct endpoint.
+A second route that consumes from the same endpoint fails to start with
+`Multiple consumers for the same endpoint is not allowed: 
direct://processOrder`.
+To send a message to several routes, use the 
xref:eips:multicast-eip.adoc[Multicast] or
+xref:eips:recipientList-eip.adoc[Recipient List] EIP, or the 
xref:seda-component.adoc[SEDA] component with
+`multipleConsumers=true`.
+
+=== When no route consumes from the endpoint
+
+When no started route consumes from the endpoint, the producer waits up to 
`timeout` milliseconds (30 seconds by
+default) for one to start, for example while Camel starts or reloads routes.
+Then the exchange fails with `DirectConsumerNotAvailableException`.
+Its message starts with `No consumers available on endpoint:`, and says which 
route consumes from the endpoint and its
+status, or that no route does (with a close endpoint name when there is one), 
and how long the producer waited.
+
+Set `block=false` to fail without waiting, or `failIfNoConsumers=false` to 
drop the message (logged at `DEBUG`) instead
+of failing.
+
+The common causes are:
+
+* The route is not loaded. With Spring Boot, the `RouteBuilder` class must be 
a Spring bean, for example annotated with
+  `@Component`. With Camel Quarkus, a `RouteBuilder` class from another jar is 
only found when that jar has a Jandex
+  index. XML and YAML routes must be in the files Camel loads routes from.
+* The producer and the route use a different name, for example because of a 
typo.
+* The route is stopped or suspended, or it did not start because of 
`autoStartup=false`.
+* The route is in another CamelContext: a direct endpoint only reaches the 
routes of its own CamelContext.
+* With the xref:manual::rest-dsl.adoc[Rest DSL], a direct route that only one 
rest service calls is inlined into that

Review Comment:
   💬 **Nit:** "rest service" should be capitalised to `REST service` — the REST 
protocol name is an acronym (Representational State Transfer).
   
   ```suggestion
   * With the xref:manual::rest-dsl.adoc[Rest DSL], a direct route that only 
one REST service calls is inlined into that
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to