This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 0e4fb11 Polish and cleanup documentation
0e4fb11 is described below
commit 0e4fb11d5ddd00aca8a8b5008b76251359a7765a
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 26 11:10:23 2021 +0200
Polish and cleanup documentation
---
.../src/main/docs/nagios-component.adoc | 41 +++----
.../camel-spring/src/main/docs/spring-summary.adoc | 6 +-
.../modules/ROOT/pages/nagios-component.adoc | 41 +++----
.../modules/ROOT/pages/spring-summary.adoc | 6 +-
...configuration-of-camelcontext-using-spring.adoc | 120 ++-------------------
.../modules/ROOT/pages/graceful-shutdown.adoc | 6 --
.../modules/ROOT/pages/spring-xml-extensions.adoc | 11 +-
7 files changed, 60 insertions(+), 171 deletions(-)
diff --git a/components/camel-nagios/src/main/docs/nagios-component.adoc
b/components/camel-nagios/src/main/docs/nagios-component.adoc
index 4bd8c1c..c3956fd 100644
--- a/components/camel-nagios/src/main/docs/nagios-component.adoc
+++ b/components/camel-nagios/src/main/docs/nagios-component.adoc
@@ -12,13 +12,12 @@
include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/nagios.ado
*{component-header}*
-The xref:nagios-component.adoc[Nagios] component allows you to send passive
checks
-to http://nagios.org[Nagios].
+The xref:nagios-component.adoc[Nagios] component allows you to send passive
checks to http://nagios.org[Nagios].
Maven users will need to add the following dependency to their `pom.xml`
for this component:
-[source,java]
+[source,xml]
------------------------------------------------------------
<dependency>
<groupId>org.apache.camel</groupId>
@@ -35,10 +34,9 @@ nagios://host[:port][?Options]
------------------------------
Camel provides two abilities with the xref:nagios-component.adoc[Nagios]
-component. You can send passive check messages by sending a message to
-its endpoint. +
- Camel also provides a EventNotifer which allows
-you to send notifications to Nagios.
+component.
+You can send passive check messages by sending a message to its endpoint. +
+Camel also provides a EventNotifer which allows you to send notifications to
Nagios.
// component-configure options: START
@@ -137,10 +135,9 @@ with the following path and query parameters:
== Sending message examples
-You can send a message to Nagios where the message payload contains the
-message. By default it will be `OK` level and use the
-CamelContext name as the service name. You can
-overrule these values using headers as shown above.
+You can send a message to Nagios where the message payload contains the
message.
+By default it will be `OK` level and use the CamelContext name as the service
name.
+You can overrule these values using headers as shown above.
For example we send the `Hello Nagios` message to Nagios as follows:
@@ -162,11 +159,11 @@ To send a `CRITICAL` message you can send the headers
such as:
template.sendBodyAndHeaders("direct:start", "Hello Nagios", headers);
-----------------------------------------------------------------------------
-== Using `NagiosEventNotifer`
+== Using NagiosEventNotifer
The xref:nagios-component.adoc[Nagios] component also provides an
-EventNotifer which you can use to send events to
-Nagios. For example we can enable this from Java as follows:
+`EventNotifer` which you can use to send events to Nagios.
+For example we can enable this from Java as follows:
[source,java]
-------------------------------------------------------------------
@@ -180,10 +177,18 @@ Nagios. For example we can enable this from Java as
follows:
return context;
-------------------------------------------------------------------
-In Spring XML its just a matter of defining a Spring bean with the type
-`EventNotifier` and Camel will pick it up as documented here:
-xref:manual::advanced-configuration-of-camelcontext-using-spring.adoc[Advanced
-configuration of CamelContext using Spring].
+In Camel on Spring XML you can declare a `<bean>` which Camel will automatic
pickup and use.
+[source,xml]
+----
+<beans>
+ <!-- setup to use nagios event notifier -->
+ <bean id="nagiosEventNotifier"
class="org.apache.camel.component.nagios.NagiosEventNotifier"/>
+
+ <camelContext>
+ ...
+ </camelContext>
+</beans>
+----
include::{page-component-version}@camel-spring-boot::page$nagios-starter.adoc[]
diff --git a/components/camel-spring/src/main/docs/spring-summary.adoc
b/components/camel-spring/src/main/docs/spring-summary.adoc
index f56472d..1a5cd0e 100644
--- a/components/camel-spring/src/main/docs/spring-summary.adoc
+++ b/components/camel-spring/src/main/docs/spring-summary.adoc
@@ -91,11 +91,9 @@ inline namespace declaration:
</camel:camelContext>
----
-=== Advanced configuration using Spring
+== Additional configuration of Spring XML
-See more details at
-xref:manual::advanced-configuration-of-camelcontext-using-spring.adoc[Advanced
-configuration of CamelContext using Spring]
+See more details at
xref:manual::advanced-configuration-of-camelcontext-using-spring.adoc[Camel
Spring XML Auto Configuration].
=== Using Java Code
diff --git a/docs/components/modules/ROOT/pages/nagios-component.adoc
b/docs/components/modules/ROOT/pages/nagios-component.adoc
index 9da4b46..37b3fa2 100644
--- a/docs/components/modules/ROOT/pages/nagios-component.adoc
+++ b/docs/components/modules/ROOT/pages/nagios-component.adoc
@@ -14,13 +14,12 @@
include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/nagios.ado
*{component-header}*
-The xref:nagios-component.adoc[Nagios] component allows you to send passive
checks
-to http://nagios.org[Nagios].
+The xref:nagios-component.adoc[Nagios] component allows you to send passive
checks to http://nagios.org[Nagios].
Maven users will need to add the following dependency to their `pom.xml`
for this component:
-[source,java]
+[source,xml]
------------------------------------------------------------
<dependency>
<groupId>org.apache.camel</groupId>
@@ -37,10 +36,9 @@ nagios://host[:port][?Options]
------------------------------
Camel provides two abilities with the xref:nagios-component.adoc[Nagios]
-component. You can send passive check messages by sending a message to
-its endpoint. +
- Camel also provides a EventNotifer which allows
-you to send notifications to Nagios.
+component.
+You can send passive check messages by sending a message to its endpoint. +
+Camel also provides a EventNotifer which allows you to send notifications to
Nagios.
// component-configure options: START
@@ -139,10 +137,9 @@ with the following path and query parameters:
== Sending message examples
-You can send a message to Nagios where the message payload contains the
-message. By default it will be `OK` level and use the
-CamelContext name as the service name. You can
-overrule these values using headers as shown above.
+You can send a message to Nagios where the message payload contains the
message.
+By default it will be `OK` level and use the CamelContext name as the service
name.
+You can overrule these values using headers as shown above.
For example we send the `Hello Nagios` message to Nagios as follows:
@@ -164,11 +161,11 @@ To send a `CRITICAL` message you can send the headers
such as:
template.sendBodyAndHeaders("direct:start", "Hello Nagios", headers);
-----------------------------------------------------------------------------
-== Using `NagiosEventNotifer`
+== Using NagiosEventNotifer
The xref:nagios-component.adoc[Nagios] component also provides an
-EventNotifer which you can use to send events to
-Nagios. For example we can enable this from Java as follows:
+`EventNotifer` which you can use to send events to Nagios.
+For example we can enable this from Java as follows:
[source,java]
-------------------------------------------------------------------
@@ -182,10 +179,18 @@ Nagios. For example we can enable this from Java as
follows:
return context;
-------------------------------------------------------------------
-In Spring XML its just a matter of defining a Spring bean with the type
-`EventNotifier` and Camel will pick it up as documented here:
-xref:manual::advanced-configuration-of-camelcontext-using-spring.adoc[Advanced
-configuration of CamelContext using Spring].
+In Camel on Spring XML you can declare a `<bean>` which Camel will automatic
pickup and use.
+[source,xml]
+----
+<beans>
+ <!-- setup to use nagios event notifier -->
+ <bean id="nagiosEventNotifier"
class="org.apache.camel.component.nagios.NagiosEventNotifier"/>
+
+ <camelContext>
+ ...
+ </camelContext>
+</beans>
+----
include::{page-component-version}@camel-spring-boot::page$nagios-starter.adoc[]
diff --git a/docs/components/modules/ROOT/pages/spring-summary.adoc
b/docs/components/modules/ROOT/pages/spring-summary.adoc
index 91c157e..b2f9309 100644
--- a/docs/components/modules/ROOT/pages/spring-summary.adoc
+++ b/docs/components/modules/ROOT/pages/spring-summary.adoc
@@ -93,11 +93,9 @@ inline namespace declaration:
</camel:camelContext>
----
-=== Advanced configuration using Spring
+== Additional configuration of Spring XML
-See more details at
-xref:manual::advanced-configuration-of-camelcontext-using-spring.adoc[Advanced
-configuration of CamelContext using Spring]
+See more details at
xref:manual::advanced-configuration-of-camelcontext-using-spring.adoc[Camel
Spring XML Auto Configuration].
=== Using Java Code
diff --git
a/docs/user-manual/modules/ROOT/pages/advanced-configuration-of-camelcontext-using-spring.adoc
b/docs/user-manual/modules/ROOT/pages/advanced-configuration-of-camelcontext-using-spring.adoc
index 4e1672b..eeb4d30 100644
---
a/docs/user-manual/modules/ROOT/pages/advanced-configuration-of-camelcontext-using-spring.adoc
+++
b/docs/user-manual/modules/ROOT/pages/advanced-configuration-of-camelcontext-using-spring.adoc
@@ -1,27 +1,16 @@
-= Advanced configuration of CamelContext using Spring
+= Camel Spring XML Auto Configuration
-When using Spring the CamelContext can be pre configured based on
-defined beans in spring XML.
+This is only applicable when using Spring XML files with the
`camel-spring-xml` JAR.
-== What can be configured
+A spring XML file is the XML files that uses `<beans>` as root tag and have an
embedded `<camelContext>`.
+This is the classic way of using XML DSL with Apache Camel, that was
implemented before Spring Boot.
-The following functions such as can be configured:
+If you use Camel on Spring Boot, then look at
xref:camelcontext-autoconfigure.adoc[Camel Context Auto Configuration] instead.
-* xref:pluggable-class-resolvers.adoc[Class resolvers]
-* xref:lifecycle.adoc[Lifecycle factories]
-* xref:registry.adoc[Registry for lookup]
-* xref:debugger.adoc[Debugger]
-* xref:tracer.adoc[Tracer]
-* xref:delay-interceptor.adoc[Delayer]
-* xref:uuidgenerator.adoc[UuidGenerator]
-* xref:{eip-vc}:eips:intercept.adoc[Intercept]
-* xref:graceful-shutdown.adoc[Graceful Shutdown]
-* xref:stream-caching.adoc[Stream caching]
-* xref:components::log-component.adoc[Log] and
xref:{eip-vc}:eips:log-eip.adoc[log() EIP]
+== Auto configuration of Optional Services
Camel will configure these functions by doing a lookup in the Spring
-bean registry to find beans of the given type
-When Camel finds and uses any of these it logs at `INFO` level.
+bean registry to find beans of the given type.
The following list all requires at most 1 beans defined. If there are
more than 1 bean of this type, then Camel will *not* use it.
@@ -129,98 +118,3 @@ instrumentation.
factory to create a route policy for every route.
|=======================================================================
-Camel will log at `INFO` level if it pickup and uses a custom bean using
-`org.apache.camel.spring.CamelContextFactoryBean` as name.
-
-[[AdvancedconfigurationofCamelContextusingSpring-Usingcontainerwideinterceptors]]
-== Using container wide interceptors
-
-Imagine that you have multiple xref:camelcontext.adoc[CamelContext] and
-you want to configure that they all use the same container wide
-interceptor. How do we do that? Well we can leverage the fact that Camel
-can auto detect and use custom interceptors. So what we simply do is to
-define our interceptor in the spring xml file. The sample below does
-this and also define 2 camel contexts. The sample is based on unit
-test.Error rendering macro 'code': Invalid value specified for parameter
-'java.lang.NullPointerException'
-
-[source,xml]
-----
-<!-- here we define a spring bean that is our container wide interceptor
- its important to notice that the class ContainerWideInterceptor implements
- org.apache.camel.spi.InterceptStrategy that allows us to plugin our
interceptors
- Camel will at startup automatic look for any beans in spring registry
that is an
- instance of org.apache.camel.spi.InterceptStrategy and add it as
interceptor
- to all its routes. Using this we are capable of defining container wide
interceptors
- that gets used in all camel contests we define with spring -->
-<bean id="myInterceptor"
class="org.apache.camel.spring.interceptor.ContainerWideInterceptor"/>
-
-<!-- here we have the 1st CamelContext -->
-<camelContext id="camel1" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:one"/>
- <to uri="mock:result"/>
- </route>
-</camelContext>
-
-<!-- and there we have the 2nd CamelContext -->
-<camelContext id="camel2" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:two"/>
- <to uri="log:two"/>
- <to uri="mock:result"/>
- </route>
-</camelContext>
-----
-
-Okay lets build our interceptor to simply count the number of
-interceptions. This is quite easy as we can just implement this logic in
-our implementation directly as the code below illustrates:Error
-rendering macro 'code': Invalid value specified for parameter
-`java.lang.NullPointerException`
-
-[source,java]
-----
-public class ContainerWideInterceptor implements InterceptStrategy {
-
- private static final Logger LOG =
LoggerFactory.getLogger(ContainerWideInterceptor.class);
- private static int count;
-
- public Processor wrapProcessorInInterceptors(final CamelContext context,
final NamedNode definition,
- final Processor target, final
Processor nextTarget) throws Exception {
-
- // as this is based on an unit test we are a bit lazy and just create
an inlined processor
- // where we implement our interception logic.
- return new Processor() {
- public void process(Exchange exchange) throws Exception {
- // we just count number of interceptions
- count++;
- LOG.info("I am the container wide interceptor. Intercepted
total count: " + count);
- // its important that we delegate to the real target so we let
target process the exchange
- target.process(exchange);
- }
-
- @Override
- public String toString() {
- return "ContainerWideInterceptor[" + target + "]";
- }
- };
- }
-
- public int getCount() {
- return count;
- }
-}
-----
-
-When Camel boots up it logs at `INFO` level the container wide
-interceptors it have found:
-
-[source,syntaxhighlighter-pre]
-----
-INFO CamelContextFactoryBean - Using custom intercept strategy with
id: myInterceptor and
implementation:org.apache.camel.spring.interceptor.ContainerWideInterceptor@b84c44
-----
-
-*Notice:* If we have more than 1 container wide interceptor, we can just
-define them as spring bean. Camel will find and use them.
-
diff --git a/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
b/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
index 01098b6..213f5f1 100644
--- a/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
+++ b/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
@@ -173,12 +173,6 @@ You can implement your own strategy to control the
shutdown by
implementing the `org.apache.camel.spi.ShutdownStrategy` and the set it
on the `CamelContext` using the `setShutdownStrategy` method.
-When using Spring XML you then just define a spring bean which
-implements the `org.apache.camel.spi.ShutdownStrategy` and Camel will
-look it up at startup and use it instead of its default. See more at
-xref:advanced-configuration-of-camelcontext-using-spring.adoc[Advanced
-configuration of CamelContext using Spring].
-
=== ShutdownAware
The interface `org.apache.camel.spi.ShutdownAware` is an optional
diff --git a/docs/user-manual/modules/ROOT/pages/spring-xml-extensions.adoc
b/docs/user-manual/modules/ROOT/pages/spring-xml-extensions.adoc
index 4b9a6ba..690cdb2 100644
--- a/docs/user-manual/modules/ROOT/pages/spring-xml-extensions.adoc
+++ b/docs/user-manual/modules/ROOT/pages/spring-xml-extensions.adoc
@@ -1,4 +1,4 @@
-[[SpringXML-SpringXM]]
+[[SpringXML-SpringXML]]
= Spring XML
Using Camel with Spring XML files, is a classic way, of using XML DSL with
Camel.
@@ -75,9 +75,6 @@ eg (`activemq`). Then you can refer to the component using
`activemq:destination
This works by the Camel lazily fetching components from the Spring context for
the scheme name you use for Endpoint xref:uris.adoc[URI]s.
-
-
-
== Using Java DSL with Spring XML files
You can use Java Code to define your xref:route-builder.adoc[RouteBuilder]
implementations. These can be defined as beans in spring and then referenced in
your camel context e.g.
@@ -85,7 +82,7 @@ You can use Java Code to define your
xref:route-builder.adoc[RouteBuilder] imple
[source,xml]
--------------------------------------------------------------------------------------------------------------
<camelContext xmlns="http://camel.apache.org/schema/spring">
- <routeBuilder ref="myBuilder" />
+ <routeBuilder ref="myBuilder"/>
</camelContext>
<bean id="myBuilder"
class="org.apache.camel.spring.example.test1.MyRouteBuilder"/>
@@ -158,8 +155,6 @@ public class MyRoute extends RouteBuilder {
You can also use the ANT style for inclusion and exclusion, as mentioned above
in the package scan section.
-
-
== Additional configuration of Spring XML
-See more details at
xref:advanced-configuration-of-camelcontext-using-spring.adoc[Advanced
configuration of CamelContext using Spring].
+See more details at
xref:advanced-configuration-of-camelcontext-using-spring.adoc[Camel Spring XML
Auto Configuration].