This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 473000d CAMEL-14191: EIP docs - Add links to last EIP patterns and
add new pages if missing content
473000d is described below
commit 473000dc74b2204e3e2e9b72ae5a1171cd6b9d91
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 20 10:27:52 2019 +0100
CAMEL-14191: EIP docs - Add links to last EIP patterns and add new pages if
missing content
---
.../ROOT/assets/images/eip/MessageHistory.gif | Bin 0 -> 2351 bytes
.../assets/images/eip/MessagingAdapterSolution.gif | Bin 0 -> 3923 bytes
.../assets/images/eip/MessagingGatewaySolution.gif | Bin 0 -> 3780 bytes
.../modules/ROOT/pages/bean-integration.adoc | 64 +++++--------
.../pages/enterprise-integration-patterns.adoc | 6 +-
.../modules/ROOT/pages/message-history.adoc | 99 +++++++++++++++++++++
.../modules/ROOT/pages/messaging-gateway.adoc | 20 +++++
.../modules/ROOT/pages/pojo-producing.adoc | 22 ++---
.../modules/ROOT/pages/service-activator.adoc | 45 ++++++++++
9 files changed, 197 insertions(+), 59 deletions(-)
diff --git a/docs/user-manual/modules/ROOT/assets/images/eip/MessageHistory.gif
b/docs/user-manual/modules/ROOT/assets/images/eip/MessageHistory.gif
new file mode 100644
index 0000000..fd40eed
Binary files /dev/null and
b/docs/user-manual/modules/ROOT/assets/images/eip/MessageHistory.gif differ
diff --git
a/docs/user-manual/modules/ROOT/assets/images/eip/MessagingAdapterSolution.gif
b/docs/user-manual/modules/ROOT/assets/images/eip/MessagingAdapterSolution.gif
new file mode 100644
index 0000000..d624bc9
Binary files /dev/null and
b/docs/user-manual/modules/ROOT/assets/images/eip/MessagingAdapterSolution.gif
differ
diff --git
a/docs/user-manual/modules/ROOT/assets/images/eip/MessagingGatewaySolution.gif
b/docs/user-manual/modules/ROOT/assets/images/eip/MessagingGatewaySolution.gif
new file mode 100644
index 0000000..8c0d0a6
Binary files /dev/null and
b/docs/user-manual/modules/ROOT/assets/images/eip/MessagingGatewaySolution.gif
differ
diff --git a/docs/user-manual/modules/ROOT/pages/bean-integration.adoc
b/docs/user-manual/modules/ROOT/pages/bean-integration.adoc
index ab32537..d0cc785 100644
--- a/docs/user-manual/modules/ROOT/pages/bean-integration.adoc
+++ b/docs/user-manual/modules/ROOT/pages/bean-integration.adoc
@@ -18,62 +18,40 @@ The following annotations is supported and inject by Camel's
[width="100%",cols="10%,90%",options="header",]
|=======================================================================
|Annotation |Description
-
-|`@EndpointInject` |To inject an endpoint, see more details at
xref:pojo-producing.adoc[POJO
-Producing].
-
-|`@BeanInject` |To inject a bean obtained from the
-Registry. See xref:bean-injection.adoc[Bean
-Injection].
-
-|`@PropertyInject` |To inject a value using
-property placeholder.
-
-|`@Produce` |To inject a producer to send message to an endpoint. See
-POJO Producing.
-
-|`@Consume` |To inject a consumer on a method. See
xref:pojo-consuming.adoc[POJO
-Consuming].
-
-|`@BindToRegistry` |Used for binding a bean to the registry. If no name is
specified then the bean will have its name auto computed based on the class
name, field name, or method name where the annotation is configured.
+|`@EndpointInject` |To inject an endpoint, see more details at
xref:pojo-producing.adoc[POJO Producing].
+|`@BeanInject` |To inject a bean obtained from the Registry. See
xref:bean-injection.adoc[Bean Injection].
+|`@PropertyInject` |To inject a value using property placeholder.
+|`@Produce` |To inject a producer to send message to an endpoint. See
xref:pojo-producing.adoc[POJO Producing].
+|`@Consume` |To inject a consumer on a method. See
xref:pojo-consuming.adoc[POJO Consuming].
+|`@BindToRegistry` |Used for binding a bean to the registry.
+ If no name is specified then the bean will have its name auto computed based
on the class name,
+ field name, or method name where the annotation is configured.
|=======================================================================
See more details at:
-* POJO Consuming to consume and possibly route
-messages from Camel
-* POJO Producing to make it easy to produce
-camel messages from your POJOs
-* DynamicRouter Annotation for
-creating a Dynamic Router from a POJO method
-* RecipientList Annotation for
-creating a Recipient List from a POJO method
-* RoutingSlip Annotation for creating
-a Routing Slip for a POJO method
-* Bean Injection to inject Camel related
-resources into your POJOs
-* xref:using-exchange-pattern-annotations.adoc[Using Exchange Pattern
-Annotations] describes how the pattern annotations can be used to change
-the behaviour of method invocations with
-Spring Remoting or
-POJO Producing
+* xref:pojo-consuming.adoc[POJO Consuming] to consume and possibly route
messages from Camel
+* xref:pojo-producing.adoc[POJO Producing] to make it easy to produce camel
messages from your POJOs
+* `@DynamicRouter` Annotation for creating a xref:dynamic-router.adoc[Dynamic
Router] from a POJO method
+* `@RecipientList` Annotation for creating a
xref:recipientList-eip.adoc[Recipient List] from a POJO method
+* `@RoutingSlip` Annotation for creating a xref:routingSlip-eip.adoc[Routing
Slip] for a POJO method
+* xref:bean-injection.adoc[Bean Injection] to inject Camel related resources
into your POJOs
+* xref:using-exchange-pattern-annotations.adoc[Using Exchange Pattern
Annotations]
+ describes how the pattern annotations can be used to change
+ the behaviour of method invocations with Spring Remoting or POJO Producing
*Example*
-See the POJO Messaging Example for how
-to use the annotations for routing and messaging.
+See the
https://github.com/apache/camel/tree/master/examples/camel-example-pojo-messaging[POJO
Messaging Example]
+for how to use the annotations for routing and messaging.
[[BeanIntegration-BeanComponent]]
== Bean Component
The xref:components::bean-component.adoc[Bean] component allows one to invoke
a particular
method. Alternately the xref:components::bean-component.adoc[Bean] component
supports the
-creation of a proxy via
-http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/bean/ProxyHelper.html[ProxyHelper]
-to a Java interface; which the implementation just sends a message
-containing a
-http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/bean/BeanInvocation.html[BeanInvocation]
-to some Camel endpoint.
+creation of a proxy via `ProxyHelper` to a Java interface; which allows to
hide sending data
+to the endpoint via an interface. See more at
xref:hiding-middleware.adoc[Hiding Middleware].
[[BeanIntegration-SpringRemoting]]
== Spring Remoting
diff --git
a/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
b/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
index 6e4760f..c95a9f3 100644
--- a/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
+++ b/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
@@ -257,11 +257,11 @@ a|image::eip/TransactionalClientIcon.gif[image]
control its transactions with the messaging system?
a|image::eip/MessagingGatewayIcon.gif[image]
-|Messaging Gateway |How do you encapsulate
+|xref:messaging-gateway.adoc[Messaging Gateway] |How do you encapsulate
access to the messaging system from the rest of the application?
a|image::eip/MessagingAdapterIcon.gif[image]
-|Service Activator |How can an application
+|xref:service-activator.adoc[Service Activator] |How can an application
design a service to be invoked both via various messaging technologies
and via non-messaging techniques?
|=======================================================================
@@ -286,7 +286,7 @@ a|image::eip/WireTapIcon.gif[image]
on a point-to-point channel?
|
-|Message History |How can we effectively
+|xref:message-history.adoc[Message History] |How can we effectively
analyze and debug the flow of messages in a loosely coupled system?
|
diff --git a/docs/user-manual/modules/ROOT/pages/message-history.adoc
b/docs/user-manual/modules/ROOT/pages/message-history.adoc
new file mode 100644
index 0000000..a903ff1
--- /dev/null
+++ b/docs/user-manual/modules/ROOT/pages/message-history.adoc
@@ -0,0 +1,99 @@
+[[Message-History]]
+= Message History
+
+Camel supports the
+https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageHistory.html[Message
History]
+from the xref:enterprise-integration-patterns.adoc[EIP patterns] book.
+
+The Message History from the EIP patterns allows for analyzing and debugging
the flow of messages in a loosely coupled system.
+
+image::eip/MessageHistory.gif[image]
+
+Attaching a Message History to the message will provide a list of all
applications that the message passed through since its origination.
+
+During routing Camel captures how the Exchange is routed, as a
`org.apache.camel.MessageHistory` entity
+that is stored on the Exchange. On the `org.apache.camel.MessageHistory` there
is information abut the
+route id, processor id, timestamp, and elapsed time it took to process the
Exchange by the processor.
+
+== Enabling or disabling Message History
+
+The Message History can be enabled or disabled per CamelContext or per route
(enabled by default).
+For example you can turn it off with
+
+[source,java]
+----
+camelContext.setMessageHistory(false);
+----
+
+Or in XML
+
+[source,xml]
+----
+<camelContext messageHistory="false">
+
+</camelContext>
+----
+
+You can also do this per route. Then a route level configuration overrides the
CamelContext level configuration.
+
+== Route stack-trace in exceptions logged by error handler
+
+If Message History is enabled, then Camel will leverage this information,
+when the Error Handler logs exhausted exceptions. Then in addition to the
caused exception with its stacktrace,
+you can see the message history; you may think this as a "route stacktrace".
+
+And example is provided below:
+
+[source,text]
+----
+2013-05-31 14:41:28,084 [ - seda://start] ERROR DefaultErrorHandler
- Failed delivery for (MessageId: ID-davsclaus-air-lan-55446-1370004087263-0-1
on ExchangeId: ID-davsclaus-air-lan-55446-1370004087263-0-3). Exhausted after
delivery attempt: 1 caught: java.lang.IllegalArgumentException: Forced to dump
message history
+
+Message History
+---------------------------------------------------------------------------------------------------------------------------------------
+RouteId ProcessorId Processor
Elapsed (ms)
+[route1 ] [to1 ] [log:foo
] [ 6]
+[route1 ] [to2 ] [direct:bar
] [ 102]
+[route2 ] [to5 ] [log:bar
] [ 1]
+[route2 ] [delay2 ] [delay[{100}]
] [ 100]
+[route2 ] [to6 ] [mock:bar
] [ 0]
+[route1 ] [delay1 ] [delay[{300}]
] [ 303]
+[route1 ] [to3 ] [log:baz
] [ 0]
+[route1 ] [process1 ]
[org.apache.camel.processor.MessageHistoryDumpRoutingTest$1$1@6a53f9d8
] [ 2]
+
+Stacktrace
+---------------------------------------------------------------------------------------------------------------------------------------
+java.lang.IllegalArgumentException: Forced to dump message history
+ at
org.apache.camel.processor.MessageHistoryDumpRoutingTest$1$1.process(MessageHistoryDumpRoutingTest.java:54)
+ at
org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
+ at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:388)
+ at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:189)
+ at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
+ at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
+ at
org.apache.camel.processor.DelayProcessorSupport.process(DelayProcessorSupport.java:117)
+ at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:388)
+ at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:189)
+ at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
+ at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
+ at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:189)
+ at
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:293)
+ at
org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:202)
+ at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:149)
+ at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
+ at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
+ at java.lang.Thread.run(Thread.java:722)
+----
+
+You can turn off logging message history from the Error Handler using
+
+[source,java]
+----
+errorHandler(defaultErrorHandler().logExhaustedMessageHistory(false));
+----
+
+From Camel 2.17 onwards the Error Handler do not log the message body/header
details anymore (to avoid logging sensitive message body details).
+You can turn on the old behavior.
+
+[source,java]
+----
+errorHandler(defaultErrorHandler().logExhaustedMessageBody(true));
+----
\ No newline at end of file
diff --git a/docs/user-manual/modules/ROOT/pages/messaging-gateway.adoc
b/docs/user-manual/modules/ROOT/pages/messaging-gateway.adoc
new file mode 100644
index 0000000..f63365b
--- /dev/null
+++ b/docs/user-manual/modules/ROOT/pages/messaging-gateway.adoc
@@ -0,0 +1,20 @@
+[[Messaging-Gateway]]
+= Messaging Gateway
+
+Camel supports the
+https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessagingGateway.html[Messaging
Gateway]
+from the xref:enterprise-integration-patterns.adoc[EIP patterns] book.
+
+How do you encapsulate access to the messaging system from the rest of the
application?
+
+image::eip/MessagingGatewaySolution.gif[image]
+
+Use a Messaging Gateway, a class than wraps messaging-specific method calls
and exposes domain-specific methods to the application.
+
+Camel has several endpoint components that support the Messaging Gateway from
the EIP patterns.
+Components like xref:components::bean-component.adoc[Bean] and
xref:components::bean-component.adoc[CXF] provide a a way
+to bind a Java interface to the message exchange.
+
+Another approach is to use `@Produce` annotations which you can read about in
xref:pojo-producing.adoc[POJO Producing]
+which also can be used as a Messaging Gateway EIP solution.
+
diff --git a/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc
b/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc
index b771974..de2d2a7 100644
--- a/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc
+++ b/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc
@@ -6,18 +6,15 @@ xref:endpoint.adoc[Endpoint] from a POJO.
[[POJOProducing-EndpointInject]]
== Via `@EndpointInject`
-To allow sending of messages from POJOs you can use the
-`org.apache.camel.EndpointInject`
-annotation. This will inject a
-`org.apache.camel.ProducerTemplate`
-so that the bean can participate in message exchanges.
+To allow sending of messages from POJOs you can use the
`org.apache.camel.EndpointInject` annotation.
+This will inject a `org.apache.camel.ProducerTemplate` so that the bean can
participate in message exchanges.
-Example: send a message to the *`foo.bar`* ActiveMQ queue:
+Example: Send a message to the *`foo.bar`* ActiveMQ queue:
-[source,syntaxhighlighter-pre]
+[source,java]
----
public class Foo {
- @EndpointInject(uri="activemq:foo.bar")
+ @EndpointInject("activemq:foo.bar")
ProducerTemplate producer;
public void doSomething() {
@@ -50,14 +47,14 @@ add the *`@Produce`* annotation to an injection point (a
field or
property setter) using a *`ProducerTemplate`* *or* using some interface
you use in your business logic. Example:
-[source,syntaxhighlighter-pre]
+[source,java]
----
public interface MyListener {
String sayHello(String name);
}
public class MyBean {
- @Produce(uri = "activemq:foo")
+ @Produce("activemq:foo")
protected MyListener producer;
public void doSomething() {
@@ -75,6 +72,5 @@ xref:spring-remoting.adoc[Spring Remoting] mechanism it is
sent to the
endpoint - in this case the xref:components::activemq-component.adoc[ActiveMQ]
endpoint to
queue *`foo`*; then the caller blocks for a response.
-If you want to make asynchronous message sends then use
-xref:using-exchange-pattern-annotations.adoc[an @InOnly annotation on
-the injection point].
+If you want to make asynchronous message sends then use an
+xref:using-exchange-pattern-annotations.adoc[@InOnly] annotation on the
injection point.
diff --git a/docs/user-manual/modules/ROOT/pages/service-activator.adoc
b/docs/user-manual/modules/ROOT/pages/service-activator.adoc
new file mode 100644
index 0000000..5ff5005
--- /dev/null
+++ b/docs/user-manual/modules/ROOT/pages/service-activator.adoc
@@ -0,0 +1,45 @@
+[[Service-Activator]]
+= Service Activator
+
+Camel supports the
+https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessagingAdapter.html[Service
Activator]
+from the xref:enterprise-integration-patterns.adoc[EIP patterns] book.
+
+How can an application design a service to be invoked both via various
messaging technologies and via non-messaging techniques?
+
+image::eip/MessagingAdapterSolution.gif[image]
+
+Design a Service Activator that connects the messages on the channel to the
service being accessed.
+
+Camel has several endpoint components that support the Service Activator from
the EIP patterns.
+
+Components like xref:components::bean-component.adoc[Bean] and
xref:components::bean-component.adoc[CXF]
+provide a a way to bind the message exchange to a Java interface/service where
the route defines the
+endpoints and wires it up to the bean.
+
+In addition you can use the xref:bean-integration.adoc[Bean Integration] to
wire messages
+to a bean using annotation, or even xref:hiding-middleware.adoc[hide all the
middleware]
+behind a plain Java interface.
+
+== Sample
+
+Here is a simple example of using a Direct endpoint to create a messaging
interface
+to a POJO Bean service.
+
+Using Java DSL
+
+[source,java]
+----
+from("direct:invokeMyService")
+ .to("bean:myService");
+----
+
+Using the XML DSL
+
+[source,xml]
+----
+<route>
+ <from uri="direct:invokeMyService"/>
+ <to uri="bean:myService"/>
+</route>
+----