diff --git a/patterns/.gitignore b/patterns/.gitignore
new file mode 100644
index 0000000000..1d420f6aaf
--- /dev/null
+++ b/patterns/.gitignore
@@ -0,0 +1 @@
+/product-service/
diff --git a/patterns/enterprise-patterns/pom.xml b/patterns/enterprise-patterns/pom.xml
new file mode 100644
index 0000000000..3637072c58
--- /dev/null
+++ b/patterns/enterprise-patterns/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ patterns
+ 1.0.0-SNAPSHOT
+
+
+ enterprise-patterns
+ pom
+
+
+ 3.7.4
+
+
+
+
+ org.apache.camel.springboot
+ camel-spring-boot-starter
+
+
+ org.apache.camel.springboot
+ camel-activemq-starter
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 2.2.2.RELEASE
+
+
+ org.apache.camel
+ camel-test-spring-junit5
+ test
+
+
+
+
+
+
+ org.apache.camel.springboot
+ camel-spring-boot-dependencies
+ ${camel.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git a/patterns/enterprise-patterns/wire-tap/README.md b/patterns/enterprise-patterns/wire-tap/README.md
new file mode 100644
index 0000000000..5f2aaf0d5a
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/README.md
@@ -0,0 +1,34 @@
+# Wire Tap Pattern
+
+The application shows you how to use a Wire Tap to monitor, debug or troubleshoot messages flowing through the system, without permanently consuming them off, or making any changes to the expected message in the output channel.
+
+This example shows how to implement this with a simple Apache Camel application using Spring Boot and Apache ActiveMq.
+For convenience, we are using in-memory activeMq.
+
+
+
+### Configuring and using the Connection Factory
+
+1. Create CamelContext.
+2. Connect to embedded (or remote) ActiveMQ JMS broker.
+3. Add JMS queue to CamelContext.
+4. Load file orders (xml/csv) from src/data into the JMS queue.
+5. Based on the extension of the incoming file message, route to the respective queues.
+6. Test that the destination route is working.
+7. Audit the received file (order) from the wire tap queue.
+
+### How to run the example:
+
+ mvn spring-boot:run
+
+
+The Wire Tap processor, by default, makes a shallow copy of the Camel Exchange instance. The copy of the exchange is sent to the endpoint specified in the wireTap statement. The body of the wire tapped message contains the same object as that in the original message which means any change to the internal state of that object during the wire tap route may also end up changing the main message’s body.
+
+To solve this, we need to create a deep copy of the object before passing it to the wire tap destination. Wire Tap EIP provides us with a mechanism to perform a “deep” copy of the message, by implementing the org.apache.camel.Processor class. This needs to be be called using onPrepare statement right after wireTap.
+For more details, check out the AmqApplicationUnitTest.class.
+
+### Relevant Articles:
+
+- [Wire tap (Enterprise Integration Pattern)](https://drafts.baeldung.com/?p=103346&preview=true)
+- [Intro to Apache camel](https://www.baeldung.com/apache-camel-intro)
+
diff --git a/patterns/enterprise-patterns/wire-tap/pom.xml b/patterns/enterprise-patterns/wire-tap/pom.xml
new file mode 100644
index 0000000000..9169c4ac91
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/pom.xml
@@ -0,0 +1,29 @@
+
+
+ 4.0.0
+ wire-tap
+ 1.0
+ jar
+
+
+ enterprise-patterns
+ com.baeldung
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/patterns/enterprise-patterns/wire-tap/src/data/.camel/msg1.xml b/patterns/enterprise-patterns/wire-tap/src/data/.camel/msg1.xml
new file mode 100644
index 0000000000..0a6fa64552
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/data/.camel/msg1.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/src/data/msg.xml b/patterns/enterprise-patterns/wire-tap/src/data/msg.xml
new file mode 100644
index 0000000000..0a6fa64552
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/data/msg.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/AmqApplication.java b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/AmqApplication.java
new file mode 100644
index 0000000000..eacef86d75
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/AmqApplication.java
@@ -0,0 +1,70 @@
+package com.baeldung;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jms.JmsComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class AmqApplication {
+
+ public static void main(String[] args) throws Exception {
+ SpringApplication.run(AmqApplication.class, args);
+
+ try (CamelContext context = new DefaultCamelContext()) {
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
+ "vm://localhost?broker.persistent=false");
+ connectionFactory.setTrustAllPackages(true);
+ context.addComponent("direct", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
+ addRoute(context);
+
+ try (ProducerTemplate template = context.createProducerTemplate()) {
+ context.start();
+
+ MyPayload payload = new MyPayload("One");
+ template.sendBody("direct:source", payload);
+ Thread.sleep(10000);
+ } finally {
+ context.stop();
+ }
+ }
+ }
+
+ private static void addRoute(CamelContext context) throws Exception {
+ context.addRoutes(newExchangeRoute());
+ }
+
+ static RoutesBuilder traditionalWireTapRoute() {
+ return new RouteBuilder() {
+ public void configure() {
+
+ from("direct:source").log("Main route: Send '${body}' to tap router").wireTap("direct:tap").delay(1000)
+ .log("Main route: Add 'two' to '${body}'").bean(MyBean.class, "addTwo").to("direct:destination")
+ .log("Main route: Output '${body}'");
+
+ from("direct:tap").log("Tap Wire route: received '${body}'")
+ .log("Tap Wire route: Add 'three' to '${body}'").bean(MyBean.class, "addThree")
+ .log("Tap Wire route: Output '${body}'");
+
+ from("direct:destination").log("Output at destination: '${body}'");
+ }
+ };
+ }
+
+ static RoutesBuilder newExchangeRoute() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+
+ from("direct:source").wireTap("direct:tap").onPrepare(new MyPayloadClonePrepare()).end().delay(1000);
+
+ from("direct:tap").bean(MyBean.class, "addThree");
+ }
+ };
+ }
+
+}
diff --git a/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyBean.java b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyBean.java
new file mode 100644
index 0000000000..62c45725b0
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyBean.java
@@ -0,0 +1,14 @@
+package com.baeldung;
+
+public class MyBean {
+
+ public MyPayload addTwo(MyPayload body) {
+ body.setValue(body.getValue() + " and two");
+ return body;
+ }
+
+ public MyPayload addThree(MyPayload body) {
+ body.setValue(body.getValue() + " and three");
+ return body;
+ }
+}
diff --git a/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyPayload.java b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyPayload.java
new file mode 100644
index 0000000000..84d6a22733
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyPayload.java
@@ -0,0 +1,31 @@
+package com.baeldung;
+
+import java.io.Serializable;
+
+public class MyPayload implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String value;
+
+ public MyPayload(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ return value;
+ }
+
+ public MyPayload deepClone() {
+ MyPayload myPayload = new MyPayload(value);
+ return myPayload;
+ }
+
+}
diff --git a/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyPayloadClonePrepare.java b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyPayloadClonePrepare.java
new file mode 100644
index 0000000000..938194bc1a
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/main/java/com/baeldung/MyPayloadClonePrepare.java
@@ -0,0 +1,15 @@
+package com.baeldung;
+
+import java.util.Date;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class MyPayloadClonePrepare implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ MyPayload myPayload = exchange.getIn().getBody(MyPayload.class);
+ exchange.getIn().setBody(myPayload.deepClone());
+ exchange.getIn().setHeader("date", new Date());
+ }
+}
diff --git a/patterns/enterprise-patterns/wire-tap/src/main/resources/application.properties b/patterns/enterprise-patterns/wire-tap/src/main/resources/application.properties
new file mode 100644
index 0000000000..a74f494fa5
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/main/resources/application.properties
@@ -0,0 +1,9 @@
+# to keep the JVM running
+camel.springboot.main-run-controller = true
+
+#configure the URL of the remote ActiveMQ broker
+#camel.component.activemq.broker-url=tcp://localhost:61616
+#spring.activemq.broker-url=tcp://localhost:61616
+
+spring.activemq.in-memory=true
+spring.activemq.pool.enabled=false
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/src/main/resources/log4j.properties b/patterns/enterprise-patterns/wire-tap/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..28aa51259a
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/src/main/resources/log4j.properties
@@ -0,0 +1,16 @@
+# Root logger option
+log4j.rootLogger=INFO, file, console
+
+log4j.logger.com.javarticles=INFO, file
+
+# Direct log messages to a log file
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=javarticles.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d | %p | %F %L | %m%n
+
+# Direct log messages to stdout
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Target=System.out
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{HH:mm}| %p | %F %L | %m%n
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-10-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-10-1-1-1
new file mode 100644
index 0000000000..25b70e3283
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-10-1-1-1
@@ -0,0 +1 @@
+Test Message: 8
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-11-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-11-1-1-1
new file mode 100644
index 0000000000..3948af158c
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-11-1-1-1
@@ -0,0 +1 @@
+Test Message: 9
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-2-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-2-1-1-1
new file mode 100644
index 0000000000..262fbf6de5
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-2-1-1-1
@@ -0,0 +1 @@
+Test Message: 0
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-3-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-3-1-1-1
new file mode 100644
index 0000000000..64a5c33134
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-3-1-1-1
@@ -0,0 +1 @@
+Test Message: 1
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-4-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-4-1-1-1
new file mode 100644
index 0000000000..de22e70d38
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-4-1-1-1
@@ -0,0 +1 @@
+Test Message: 2
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-5-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-5-1-1-1
new file mode 100644
index 0000000000..d400e1afeb
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-5-1-1-1
@@ -0,0 +1 @@
+Test Message: 3
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-6-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-6-1-1-1
new file mode 100644
index 0000000000..660c960fcb
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-6-1-1-1
@@ -0,0 +1 @@
+Test Message: 4
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-7-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-7-1-1-1
new file mode 100644
index 0000000000..c97f21578a
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-7-1-1-1
@@ -0,0 +1 @@
+Test Message: 5
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-8-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-8-1-1-1
new file mode 100644
index 0000000000..be38d662ff
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-8-1-1-1
@@ -0,0 +1 @@
+Test Message: 6
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-9-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-9-1-1-1
new file mode 100644
index 0000000000..518e4227fc
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-34209-1621429668568-4-9-1-1-1
@@ -0,0 +1 @@
+Test Message: 7
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-10-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-10-1-1-1
new file mode 100644
index 0000000000..25b70e3283
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-10-1-1-1
@@ -0,0 +1 @@
+Test Message: 8
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-11-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-11-1-1-1
new file mode 100644
index 0000000000..3948af158c
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-11-1-1-1
@@ -0,0 +1 @@
+Test Message: 9
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-2-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-2-1-1-1
new file mode 100644
index 0000000000..262fbf6de5
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-2-1-1-1
@@ -0,0 +1 @@
+Test Message: 0
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-3-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-3-1-1-1
new file mode 100644
index 0000000000..64a5c33134
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-3-1-1-1
@@ -0,0 +1 @@
+Test Message: 1
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-4-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-4-1-1-1
new file mode 100644
index 0000000000..de22e70d38
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-4-1-1-1
@@ -0,0 +1 @@
+Test Message: 2
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-5-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-5-1-1-1
new file mode 100644
index 0000000000..d400e1afeb
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-5-1-1-1
@@ -0,0 +1 @@
+Test Message: 3
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-6-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-6-1-1-1
new file mode 100644
index 0000000000..660c960fcb
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-6-1-1-1
@@ -0,0 +1 @@
+Test Message: 4
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-7-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-7-1-1-1
new file mode 100644
index 0000000000..c97f21578a
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-7-1-1-1
@@ -0,0 +1 @@
+Test Message: 5
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-8-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-8-1-1-1
new file mode 100644
index 0000000000..be38d662ff
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-8-1-1-1
@@ -0,0 +1 @@
+Test Message: 6
\ No newline at end of file
diff --git a/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-9-1-1-1 b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-9-1-1-1
new file mode 100644
index 0000000000..518e4227fc
--- /dev/null
+++ b/patterns/enterprise-patterns/wire-tap/test/ID-PRINHYLTPDL1209-46717-1621429562728-4-9-1-1-1
@@ -0,0 +1 @@
+Test Message: 7
\ No newline at end of file
diff --git a/patterns/pom.xml b/patterns/pom.xml
index 3bde26cae2..6e92ad2813 100644
--- a/patterns/pom.xml
+++ b/patterns/pom.xml
@@ -28,6 +28,7 @@
intercepting-filter
solid
clean-architecture
+ enterprise-patterns