This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 91917701b0e57269aa468a24981267e5486acd77
Author: Bahaa Zaid <bahaa.z...@pixelogicmedia.com>
AuthorDate: Wed Jul 3 22:53:51 2019 +0200

    Implementing PostgreSQL Replication Slot consumer Camel component.
---
 apache-camel/pom.xml                               |  10 +
 apache-camel/src/main/descriptors/common-bin.xml   |   2 +
 bom/camel-bom/pom.xml                              |  10 +
 components/camel-pg-replication-slot/pom.xml       |  79 +++++++
 .../main/docs/pg-replication-slot-component.adoc   | 162 +++++++++++++
 .../slot/PgReplicationSlotComponent.java           |  42 ++++
 .../slot/PgReplicationSlotConsumer.java            | 249 ++++++++++++++++++++
 .../slot/PgReplicationSlotEndpoint.java            | 253 +++++++++++++++++++++
 .../slot/PgReplicationSlotEndpointTest.java        |  80 +++++++
 .../PgReplicationSlotIntegrationTest.java          | 127 +++++++++++
 .../src/test/resources/log4j2.properties           |  28 +++
 .../src/test/resources/test-options.properties     |  35 +++
 components/pom.xml                                 |   1 +
 components/readme.adoc                             |   3 +
 .../PgReplicationSlotEndpointBuilderFactory.java   | 253 +++++++++++++++++++++
 parent/pom.xml                                     |  11 +
 .../karaf/features/src/main/resources/features.xml |   6 +
 .../camel-pg-replication-slot-starter/pom.xml      |  53 +++++
 ...gReplicationSlotComponentAutoConfiguration.java | 129 +++++++++++
 .../PgReplicationSlotComponentConfiguration.java   |  67 ++++++
 .../src/main/resources/META-INF/LICENSE.txt        | 203 +++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt         |  11 +
 .../additional-spring-configuration-metadata.json  |  10 +
 .../src/main/resources/META-INF/spring.factories   |  19 ++
 .../src/main/resources/META-INF/spring.provides    |  17 ++
 platforms/spring-boot/components-starter/pom.xml   |   1 +
 .../camel-spring-boot-dependencies/pom.xml         |  10 +
 .../itest/karaf/CamelPgReplicationSlotTest.java    |  34 +++
 .../springboot/CamelPgReplicationSlotTest.java     |  49 ++++
 29 files changed, 1954 insertions(+)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 5068a1b..09bb095 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1114,6 +1114,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-pg-replication-slot</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-pgevent</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -2598,6 +2603,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-pg-replication-slot-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-pgevent-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
diff --git a/apache-camel/src/main/descriptors/common-bin.xml 
b/apache-camel/src/main/descriptors/common-bin.xml
index 8a83636..3618211 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -243,6 +243,7 @@
         <include>org.apache.camel:camel-paho</include>
         <include>org.apache.camel:camel-paxlogging</include>
         <include>org.apache.camel:camel-pdf</include>
+        <include>org.apache.camel:camel-pg-replication-slot</include>
         <include>org.apache.camel:camel-pgevent</include>
         <include>org.apache.camel:camel-printer</include>
         <include>org.apache.camel:camel-properties</include>
@@ -579,6 +580,7 @@
         <include>org.apache.camel:camel-optaplanner-starter</include>
         <include>org.apache.camel:camel-paho-starter</include>
         <include>org.apache.camel:camel-pdf-starter</include>
+        <include>org.apache.camel:camel-pg-replication-slot-starter</include>
         <include>org.apache.camel:camel-pgevent-starter</include>
         <include>org.apache.camel:camel-printer-starter</include>
         <include>org.apache.camel:camel-properties-starter</include>
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 26112b3..22c93e9 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -2120,6 +2120,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pg-replication-slot</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pg-replication-slot-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-pgevent</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/components/camel-pg-replication-slot/pom.xml 
b/components/camel-pg-replication-slot/pom.xml
new file mode 100644
index 0000000..60db7f6
--- /dev/null
+++ b/components/camel-pg-replication-slot/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-pg-replication-slot</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: PgReplicationSlot</name>
+    <description>Component for receiving from PostgreSQL Replication 
Slots</description>
+
+    <properties>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <version>${pgjdbc-driver-version}</version>
+        </dependency>
+
+        <!-- testing -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- logging -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git 
a/components/camel-pg-replication-slot/src/main/docs/pg-replication-slot-component.adoc
 
b/components/camel-pg-replication-slot/src/main/docs/pg-replication-slot-component.adoc
new file mode 100644
index 0000000..7cab4eb
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/main/docs/pg-replication-slot-component.adoc
@@ -0,0 +1,162 @@
+[[pg-replication-slot-component]]
+== PostgresSQL Replication Slot Component
+
+*Available as of Camel version 3.0*
+
+This is a component for Apache Camel which allows for
+consuming from PostgreSQL replication slots. The component works with 
PostgreSQL 10 or later.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-pg-replication-slot</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+URI format
+
+The pg-replication-slot component uses the following two styles of endpoint URI
+notation:
+
+[source,java]
+-------------------------------------------------
+pg-replication-slot://host:port/database/slot:plugin[?parameters]
+-------------------------------------------------
+
+You can append query options to the URI in the following format,
+`?option=value&option=value&...`
+
+### Options
+
+
+// component options: START
+The PostgresSQL Replication Slot component supports 2 options, which are 
listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *resolveProperty Placeholders* (advanced) | Whether the component should 
resolve property placeholders on itself when starting. Only properties which 
are of String type can use property placeholders. | true | boolean
+| *basicPropertyBinding* (advanced) | Whether the component should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
+|===
+// component options: END
+
+
+
+// endpoint options: START
+The PostgresSQL Replication Slot endpoint is configured using URI syntax:
+
+----
+pg-replication-slot:host:port/database/slot:plugin
+----
+
+with the following path and query parameters:
+
+==== Path Parameters (5 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *slot* | *Required* Replication slot name. |  | String
+| *host* | PostgreSQL server host | localhost | String
+| *port* | PostgreSQL server port | 5432 | Integer
+| *database* | *Required* PostgreSQL database name |  | String
+| *outputPlugin* | *Required* Output plugin name (e.g. test_decoding, 
wal2json) |  | String
+|===
+
+
+==== Query Parameters (25 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *password* (common) | PostgreSQL password |  | String
+| *user* (common) | PostgreSQL username | postgres | String
+| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
+| *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll 
any files, you can enable this option to send an empty message (no body) 
instead. | false | boolean
+| *exceptionHandler* (consumer) | To let the consumer use a custom 
ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this 
option is not in use. By default the consumer will deal with exceptions, that 
will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
+| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer 
creates an exchange. |  | ExchangePattern
+| *pollStrategy* (consumer) | A pluggable 
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your 
custom implementation to control error handling usually occurred during the 
poll operation before an Exchange have been created and being routed in Camel. 
|  | PollingConsumerPoll Strategy
+| *autoCreateSlot* (advanced) | Auto create slot if it does not exist | true | 
Boolean
+| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
+| *slotOptions* (advanced) | Slot options to be passed to the output plugin. | 
 | Map
+| *statusInterval* (advanced) | Specifies the number of seconds between status 
packets sent back to Postgres server. | 10 | Integer
+| *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used, or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
+| *backoffErrorThreshold* (scheduler) | The number of subsequent error polls 
(failed due some error) that should happen before the backoffMultipler should 
kick-in. |  | int
+| *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls 
that should happen before the backoffMultipler should kick-in. |  | int
+| *backoffMultiplier* (scheduler) | To let the scheduled polling consumer 
backoff if there has been a number of subsequent idles/errors in a row. The 
multiplier is then the number of polls that will be skipped before the next 
actual attempt is happening again. When this option is in use then 
backoffIdleThreshold and/or backoffErrorThreshold must also be configured. |  | 
int
+| *delay* (scheduler) | Milliseconds before the next poll. You can also 
specify time values using units, such as 60s (60 seconds), 5m30s (5 minutes and 
30 seconds), and 1h (1 hour). | 500 | long
+| *greedy* (scheduler) | If greedy is enabled, then the ScheduledPollConsumer 
will run immediately again, if the previous run polled 1 or more messages. | 
false | boolean
+| *initialDelay* (scheduler) | Milliseconds before the first poll starts. You 
can also specify time values using units, such as 60s (60 seconds), 5m30s (5 
minutes and 30 seconds), and 1h (1 hour). | 1000 | long
+| *runLoggingLevel* (scheduler) | The consumer logs a start/complete log line 
when it polls. This option allows you to configure the logging level for that. 
| TRACE | LoggingLevel
+| *scheduledExecutorService* (scheduler) | Allows for configuring a 
custom/shared thread pool to use for the consumer. By default each consumer has 
its own single threaded thread pool. |  | ScheduledExecutor Service
+| *scheduler* (scheduler) | To use a cron scheduler from either camel-spring 
or camel-quartz2 component | none | ScheduledPollConsumer Scheduler
+| *schedulerProperties* (scheduler) | To configure additional properties when 
using a custom scheduler or any of the Quartz2, Spring based scheduler. |  | Map
+| *startScheduler* (scheduler) | Whether the scheduler should be auto started. 
| true | boolean
+| *timeUnit* (scheduler) | Time unit for initialDelay and delay options. | 
MILLISECONDS | TimeUnit
+| *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used. 
See ScheduledExecutorService in JDK for details. | true | boolean
+|===
+// endpoint options: END
+// spring-boot-auto-configure options: START
+=== Spring Boot Auto-Configuration
+
+When using Spring Boot make sure to use the following Maven dependency to have 
support for auto configuration:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-pg-replication-slot-starter</artifactId>
+  <version>x.x.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+
+The component supports 3 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.component.pg-replication-slot.basic-property-binding* | Whether the 
component should use basic property binding (Camel 2.x) or the newer property 
binding with additional capabilities | false | Boolean
+| *camel.component.pg-replication-slot.enabled* | Enable pg-replication-slot 
component | true | Boolean
+| *camel.component.pg-replication-slot.resolve-property-placeholders* | 
Whether the component should resolve property placeholders on itself when 
starting. Only properties which are of String type can use property 
placeholders. | true | Boolean
+|===
+// spring-boot-auto-configure options: END
+
+### Example
+
+[source,java]
+----
+from("pg-replication-slot://localhost:5432/finance/sync_slot:test_decoding?user={{username}}&password={{password}}&slotOptions.skip-empty-xacts=true&slotOptions.include-xids=false")
+    .to("mock:result");
+----
+
+### Tips
+
+TIP: PostgreSQL can generate a huge amount of empty transactions on certain 
operations (e.g. `VACUUM`). These transactions can congest
+your route. Using `greedy=true` query parameter can help with this problem. It 
will help your route filter out empty transactions quickly
+without waiting for the `delay`*`timeUnit` parameter between each exchange.
+
+TIP: The order of the messages is guaranteed, but the same message might come 
more than once. So, for example, if you're using
+this component to sync data from PostgreSQL to other database, make sure your 
operations are idempotent (e.g. use UPSERT
+instead of INSERT,...). This will make sure repeated messages won't affect 
your system negatively.
+
+
+### See Also
+
+* Configuring Camel
+* Component
+* Endpoint
+* Getting Started
diff --git 
a/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotComponent.java
 
b/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotComponent.java
new file mode 100644
index 0000000..3059b4f
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.support.IntrospectionSupport;
+
+/**
+ * Represents the component that manages {@link PgReplicationSlotEndpoint}.
+ */
+@Component("pg-replication-slot")
+public class PgReplicationSlotComponent extends DefaultComponent {
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        PgReplicationSlotEndpoint endpoint = new 
PgReplicationSlotEndpoint(uri, this);
+        setProperties(endpoint, parameters);
+
+        Map<String, Object> slotOptions = 
IntrospectionSupport.extractProperties(parameters, "slotOptions.");
+        endpoint.setSlotOptions(slotOptions);
+
+        return endpoint;
+    }
+}
diff --git 
a/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotConsumer.java
 
b/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotConsumer.java
new file mode 100644
index 0000000..5073f97
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotConsumer.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot;
+
+import java.net.SocketException;
+import java.nio.ByteBuffer;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.spi.Synchronization;
+import org.apache.camel.support.ScheduledPollConsumer;
+import org.postgresql.PGConnection;
+import org.postgresql.replication.PGReplicationStream;
+import org.postgresql.replication.fluent.logical.ChainedLogicalStreamBuilder;
+
+/**
+ * The pg-replication-slot consumer.
+ */
+public class PgReplicationSlotConsumer extends ScheduledPollConsumer {
+
+    private final PgReplicationSlotEndpoint endpoint;
+
+    private Connection connection;
+    private PGConnection pgConnection;
+    private PGReplicationStream replicationStream;
+
+    private ScheduledExecutorService scheduledExecutor;
+
+    private byte[] payload;
+
+    PgReplicationSlotConsumer(PgReplicationSlotEndpoint endpoint, Processor 
processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        this.connect();
+
+        if (this.scheduledExecutor == null) {
+            this.scheduledExecutor = 
this.getEndpoint().getCamelContext().getExecutorServiceManager()
+                    .newSingleThreadScheduledExecutor(this, 
"PgReplicationStatusUpdateSender");
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+
+        if (this.connection != null) {
+            this.connection.close();
+            this.connection = null;
+        }
+
+        if (this.scheduledExecutor != null) {
+            
this.getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(this.scheduledExecutor);
+            this.scheduledExecutor = null;
+        }
+    }
+
+    @Override
+    protected int poll() throws Exception {
+        PGReplicationStream stream = getStream();
+
+        // If the stream is null, this means the slot is active, i.e. used by 
another connection. We'll try
+        // again on the next poll.
+        if (stream == null) {
+            return 0;
+        }
+
+        try {
+            // The same payload will be sent again and again until the 
processing is completed successfully.
+            // We should not read another payload before that to guarantee the 
order of processing.
+            if (this.payload == null) {
+                ByteBuffer msg = stream.readPending();
+
+                if (msg == null) {
+                    return 0;
+                }
+
+                int offset = msg.arrayOffset();
+                byte[] source = msg.array();
+                int length = source.length - offset;
+
+                this.payload = new byte[length];
+                System.arraycopy(source, offset, this.payload, 0, length);
+            }
+        } catch (SQLException e) {
+            // If the cause of the exception is that connection is lost, we'll 
try to reconnect so in the next poll a
+            // new connection will be available.
+            if (e.getCause() instanceof SocketException) {
+                log.info("Connection to PosgreSQL server has been lost, trying 
to reconnect.");
+                this.connect();
+            }
+            throw e;
+        }
+
+        Exchange exchange = this.endpoint.createExchange();
+        exchange.setExchangeId(stream.getLastReceiveLSN().asString());
+
+        Message message = exchange.getIn();
+        message.setBody(this.payload);
+
+        final long delay = this.endpoint.getStatusInterval();
+        ScheduledFuture<?> scheduledFuture = 
this.scheduledExecutor.scheduleAtFixedRate(() -> {
+            try {
+                log.debug("Processing took too long. Sending status update to 
avoid disconnect.");
+                stream.forceUpdateStatus();
+            } catch (SQLException e) {
+                log.error(e.getMessage(), e);
+            }
+        }, delay, delay, TimeUnit.SECONDS);
+
+        exchange.addOnCompletion(new Synchronization() {
+            @Override
+            public void onComplete(Exchange exchange) {
+                processCommit(exchange);
+                scheduledFuture.cancel(true);
+            }
+
+            @Override
+            public void onFailure(Exchange exchange) {
+                processRollback(exchange);
+                scheduledFuture.cancel(true);
+            }
+        });
+
+        getProcessor().process(exchange);
+
+        return 1;
+    }
+
+    private void processCommit(Exchange exchange) {
+        try {
+            PGReplicationStream stream = getStream();
+
+            if (stream == null) {
+                return;
+            }
+
+            stream.setAppliedLSN(stream.getLastReceiveLSN());
+            stream.setFlushedLSN(stream.getLastReceiveLSN());
+            stream.forceUpdateStatus();
+
+            this.payload = null;
+        } catch (SQLException e) {
+            getExceptionHandler().handleException("Exception while sending 
feedback to PostgreSQL.", exchange, e);
+        }
+    }
+
+    private void processRollback(Exchange exchange) {
+        Exception cause = exchange.getException();
+        if (cause != null) {
+            getExceptionHandler().handleException("Error during processing 
exchange. Will attempt to process the message on next poll.", exchange, cause);
+        }
+    }
+
+    private void createSlot() throws SQLException {
+        this.pgConnection.getReplicationAPI()
+                .createReplicationSlot()
+                .logical()
+                .withSlotName(this.endpoint.getSlot())
+                .withOutputPlugin(this.endpoint.getOutputPlugin())
+                .make();
+    }
+
+    private boolean isSlotCreated() throws SQLException {
+        String sql = String.format("SELECT count(*) FROM pg_replication_slots 
WHERE slot_name = '%s';", this.endpoint.getSlot());
+
+        try (Statement statement = this.connection.createStatement(); 
ResultSet resultSet = statement.executeQuery(sql)) {
+            resultSet.next();
+            return resultSet.getInt(1) > 0;
+        }
+    }
+
+    private PGReplicationStream getStream() throws SQLException {
+        if (this.replicationStream != null && 
!this.replicationStream.isClosed()) {
+            return this.replicationStream;
+        }
+
+        if (isSlotActive()) {
+            log.debug(String.format("Slot: %s is active. Waiting for it to be 
available.", this.endpoint.getSlot()));
+            return null;
+        }
+
+        ChainedLogicalStreamBuilder streamBuilder = 
this.pgConnection.getReplicationAPI()
+                .replicationStream()
+                .logical()
+                .withSlotName(this.endpoint.getSlot())
+                .withStatusInterval(this.endpoint.getStatusInterval(), 
TimeUnit.SECONDS);
+
+        Properties slotOptions = new Properties();
+        slotOptions.putAll(this.endpoint.getSlotOptions());
+        streamBuilder.withSlotOptions(slotOptions);
+
+        this.replicationStream = streamBuilder.start();
+
+        return this.replicationStream;
+    }
+
+    private boolean isSlotActive() throws SQLException {
+        String sql = String.format("SELECT count(*) FROM pg_replication_slots 
where slot_name = '%s' AND active = true;",
+                this.endpoint.getSlot());
+
+        try (Statement statement = this.connection.createStatement(); 
ResultSet resultSet = statement.executeQuery(sql)) {
+            resultSet.next();
+            return resultSet.getInt(1) > 0;
+        }
+    }
+
+    private void connect() throws SQLException {
+        if (this.connection != null) {
+            this.connection.close();
+        }
+
+        this.connection = this.endpoint.newDbConnection();
+        this.pgConnection = this.connection.unwrap(PGConnection.class);
+        this.replicationStream = null;
+
+        if (this.endpoint.getAutoCreateSlot() && !this.isSlotCreated()) {
+            this.createSlot();
+        }
+    }
+}
diff --git 
a/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpoint.java
 
b/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpoint.java
new file mode 100644
index 0000000..7679c3a
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpoint.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.postgresql.PGProperty;
+
+/**
+ * Consumer endpoint to receive from PostgreSQL Replication Slot.
+ */
+@UriEndpoint(firstVersion = "3.0.0", scheme = "pg-replication-slot", title = 
"PostgresSQL Replication Slot",
+        syntax = "pg-replication-slot:host:port/database/slot:plugin", label = 
"database,sql", consumerOnly = true)
+public class PgReplicationSlotEndpoint extends ScheduledPollEndpoint {
+
+    private static final Pattern URI_PATTERN = Pattern.compile(
+            
"^pg-replication-slot:(//)?(?<host>[^:]*):?(?<port>\\d*)?/(?<database>\\w+)/(?<slot>\\w+):(?<plugin>\\w+).*$");
+
+    @UriPath(description = "Postgres host", label = "common", defaultValue = 
"localhost")
+    private String host = "localhost";
+    @UriPath(description = "Postgres port", label = "common", defaultValue = 
"5432")
+    private Integer port = 5432;
+    @UriPath(description = "Postgres database name", label = "common")
+    @Metadata(required = true)
+    private String database;
+    @UriPath
+    @Metadata(description = "Replication Slot name", label = "common", 
required = true)
+    private String slot;
+    @UriPath
+    @Metadata(description = "Output plugin name", label = "common", required = 
true)
+    private String outputPlugin;
+    @UriParam(description = "Postgres user", label = "common", defaultValue = 
"postgres")
+    private String user = "postgres";
+    @UriParam(description = "Postgres password", label = "common", secret = 
true)
+    private String password;
+    @UriParam(label = "advanced", defaultValue = "10")
+    private Integer statusInterval = 10;
+    @UriParam(label = "advanced", prefix = "slotOptions.", multiValue = true)
+    private Map<String, Object> slotOptions = Collections.emptyMap();
+    @UriParam(label = "advanced", defaultValue = "true")
+    private Boolean autoCreateSlot = true;
+
+    public PgReplicationSlotEndpoint(String uri, Component component) {
+        super(uri, component);
+        parseUri(uri);
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return null;
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        PgReplicationSlotConsumer consumer = new 
PgReplicationSlotConsumer(this, processor);
+        configureConsumer(consumer);
+        return consumer;
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    /**
+     * Creates a new PostgreSQL JDBC connection that's setup for replication.
+     *
+     * @return JDBC connection
+     * @throws SQLException
+     */
+    Connection newDbConnection() throws SQLException {
+        Properties props = new Properties();
+
+        PGProperty.USER.set(props, this.getUser());
+        PGProperty.PASSWORD.set(props, this.getPassword());
+        PGProperty.ASSUME_MIN_SERVER_VERSION.set(props, "9.6");
+        PGProperty.REPLICATION.set(props, "database");
+        PGProperty.PREFER_QUERY_MODE.set(props, "simple");
+        PGProperty.TCP_KEEP_ALIVE.set(props, true);
+
+        return DriverManager.getConnection(
+                String.format("jdbc:postgresql://%s:%d/%s", this.getHost(), 
this.getPort(), this.getDatabase()),
+                props);
+    }
+
+    /**
+     * Parse the provided URI and extract available parameters
+     *
+     * @throws IllegalArgumentException if there is an error in the parameters
+     */
+    protected final void parseUri(String uri) {
+        log.info("URI: {}", uri);
+
+        Matcher matcher = URI_PATTERN.matcher(uri);
+
+        if (!matcher.matches()) {
+            throw new IllegalArgumentException("The provided URL does not 
match the acceptable pattern");
+        }
+
+        if (matcher.group("host").length() > 0) {
+            this.setHost(matcher.group("host"));
+        }
+
+        if (matcher.group("port").length() > 0) {
+            this.setPort(Integer.valueOf(matcher.group("port")));
+        }
+
+        this.setDatabase(matcher.group("database"));
+        this.setSlot(matcher.group("slot"));
+        this.setOutputPlugin(matcher.group("plugin"));
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * PostgreSQL server host
+     */
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public Integer getPort() {
+        return port;
+    }
+
+    /**
+     * PostgreSQL server port
+     */
+    public void setPort(Integer port) {
+        this.port = port;
+    }
+
+    public String getDatabase() {
+        return database;
+    }
+
+    /**
+     * PostgreSQL database name
+     */
+    public void setDatabase(String database) {
+        this.database = database;
+    }
+
+    public String getSlot() {
+        return slot;
+    }
+
+    /**
+     * Replication slot name.
+     */
+    public void setSlot(String slot) {
+        this.slot = slot;
+    }
+
+    public String getOutputPlugin() {
+        return outputPlugin;
+    }
+
+    /**
+     * Output plugin name (e.g. test_decoding, wal2json)
+     */
+    public void setOutputPlugin(String outputPlugin) {
+        this.outputPlugin = outputPlugin;
+    }
+
+    public String getUser() {
+        return user;
+    }
+
+    /**
+     * PostgreSQL username
+     */
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    /**
+     * PostgreSQL password
+     */
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public Integer getStatusInterval() {
+        return statusInterval;
+    }
+
+    /**
+     * Specifies the number of seconds between status packets sent back to 
Postgres server.
+     */
+    public void setStatusInterval(Integer statusInterval) {
+        this.statusInterval = statusInterval;
+    }
+
+
+    public Map<String, Object> getSlotOptions() {
+        return slotOptions;
+    }
+
+    /**
+     * Slot options to be passed to the output plugin.
+     */
+    public void setSlotOptions(Map<String, Object> slotOptions) {
+        this.slotOptions = slotOptions;
+    }
+
+    public Boolean getAutoCreateSlot() {
+        return autoCreateSlot;
+    }
+
+    /**
+     * Auto create slot if it does not exist
+     */
+    public void setAutoCreateSlot(Boolean autoCreateSlot) {
+        this.autoCreateSlot = autoCreateSlot;
+    }
+}
diff --git 
a/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java
 
b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java
new file mode 100644
index 0000000..aa078bf
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PgReplicationSlotEndpointTest {
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @Test
+    public void testUriParsing() {
+        PgReplicationSlotEndpoint endpoint = null;
+        PgReplicationSlotComponent component = 
mock(PgReplicationSlotComponent.class);
+
+        endpoint = new 
PgReplicationSlotEndpoint("pg-replication-slot:/database/slot:plugin", 
component);
+
+        assertEquals(endpoint.getDatabase(), "database");
+        assertEquals(endpoint.getPort(), Integer.valueOf(5432));
+        assertEquals(endpoint.getHost(), "localhost");
+        assertEquals(endpoint.getSlot(), "slot");
+        assertEquals(endpoint.getOutputPlugin(), "plugin");
+
+        endpoint = new 
PgReplicationSlotEndpoint("pg-replication-slot:remote-server/database/slot:plugin",
 component);
+
+        assertEquals(endpoint.getDatabase(), "database");
+        assertEquals(endpoint.getPort(), Integer.valueOf(5432));
+        assertEquals(endpoint.getHost(), "remote-server");
+        assertEquals(endpoint.getSlot(), "slot");
+        assertEquals(endpoint.getOutputPlugin(), "plugin");
+
+        endpoint = new 
PgReplicationSlotEndpoint("pg-replication-slot:remote-server:333/database/slot:plugin",
 component);
+
+        assertEquals(endpoint.getDatabase(), "database");
+        assertEquals(endpoint.getPort(), Integer.valueOf(333));
+        assertEquals(endpoint.getHost(), "remote-server");
+        assertEquals(endpoint.getSlot(), "slot");
+        assertEquals(endpoint.getOutputPlugin(), "plugin");
+
+        endpoint = new 
PgReplicationSlotEndpoint("pg-replication-slot://remote-server:333/database/slot:plugin",
 component);
+
+        assertEquals(endpoint.getDatabase(), "database");
+        assertEquals(endpoint.getPort(), Integer.valueOf(333));
+        assertEquals(endpoint.getHost(), "remote-server");
+        assertEquals(endpoint.getSlot(), "slot");
+        assertEquals(endpoint.getOutputPlugin(), "plugin");
+    }
+
+    @Test
+    public void testParsingBadUri() {
+        this.expectedException.expect(IllegalArgumentException.class);
+
+        PgReplicationSlotComponent component = 
mock(PgReplicationSlotComponent.class);
+
+        new PgReplicationSlotEndpoint("pg-replication-slot:/database/slot", 
component);
+    }
+}
diff --git 
a/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java
 
b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java
new file mode 100644
index 0000000..610ebc8
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot.integration;
+
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.PropertyInject;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PgReplicationSlotIntegrationTest extends CamelTestSupport {
+
+    @EndpointInject("mock:result")
+    private MockEndpoint mockEndpoint;
+
+    
@EndpointInject("pg-replication-slot://{{host}}:{{port}}/{{database}}/camel_test_slot:test_decoding?"
+            + 
"user={{username}}&password={{password}}&slotOptions.skip-empty-xacts=true&slotOptions.include-xids=false")
+    private Endpoint pgReplicationSlotEndpoint;
+
+    @PropertyInject("host")
+    private String host;
+
+    @PropertyInject("port")
+    private String port;
+
+    @PropertyInject("database")
+    private String database;
+
+    @PropertyInject("username")
+    private String username;
+
+    @PropertyInject("password")
+    private String password;
+
+    private Connection connection;
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        String url = String.format("jdbc:postgresql://%s:%s/%s", this.host, 
this.port, this.database);
+        Properties props = new Properties();
+        props.setProperty("user", username);
+        props.setProperty("password", password);
+
+        this.connection = DriverManager.getConnection(url, props);
+        try (Statement statement = this.connection.createStatement()) {
+            statement.execute("CREATE TABLE IF NOT EXISTS camel_test_table(id 
int);");
+        }
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+
+        try (Statement statement = this.connection.createStatement()) {
+            statement.execute("DROP TABLE IF EXISTS camel_test_table;");
+            statement.execute("SELECT 
pg_drop_replication_slot('camel_test_slot');");
+        }
+        this.connection.close();
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+        PropertiesComponent component = new 
PropertiesComponent("classpath:/test-options.properties");
+        camelContext.addComponent("properties", component);
+        return camelContext;
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(pgReplicationSlotEndpoint).to(mockEndpoint);
+            }
+        };
+    }
+
+    @Test
+    public void canReceiveFromSlot() throws InterruptedException, SQLException 
{
+        mockEndpoint.expectedMessageCount(1);
+
+        // test_decoding plugin writes each change in a separate message. Some 
other plugins can have different behaviour,
+        // wal2json default behaviour is to write the whole transaction in one 
message.
+        mockEndpoint.expectedBodiesReceived("BEGIN", "table 
public.camel_test_table: INSERT: id[integer]:1984", "COMMIT",
+                "BEGIN", "table public.camel_test_table: INSERT: 
id[integer]:1998", "COMMIT");
+
+        try (Statement statement = this.connection.createStatement()) {
+            statement.execute("INSERT INTO camel_test_table(id) 
VALUES(1984);");
+            statement.execute("INSERT INTO camel_test_table(id) 
VALUES(1998);");
+        }
+
+        mockEndpoint.assertIsSatisfied(5000);
+    }
+}
diff --git 
a/components/camel-pg-replication-slot/src/test/resources/log4j2.properties 
b/components/camel-pg-replication-slot/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..114e839
--- /dev/null
+++ b/components/camel-pg-replication-slot/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-pg-replication-slot-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.stdout.type = Console
+appender.stdout.name = stdout
+appender.stdout.layout.type = PatternLayout
+appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git 
a/components/camel-pg-replication-slot/src/test/resources/test-options.properties
 
b/components/camel-pg-replication-slot/src/test/resources/test-options.properties
new file mode 100644
index 0000000..686c67e
--- /dev/null
+++ 
b/components/camel-pg-replication-slot/src/test/resources/test-options.properties
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# Change the following properties to work with your PostgreSQL instance.
+
+# The host where PostgreSQL server is running. The `wal_level` config must be 
set to `logical`
+host=localhost
+
+# The port that PostgreSQL is bound to
+port=5432
+
+# The user name used for connecting to PostgreSQL. The user must have the 
`replication` role or a `superuser`.
+username=camel
+
+# The password used for connecting to PostgreSQL
+password=camel
+
+# The name of the database to use during integration testing
+database=camel
+
+
diff --git a/components/pom.xml b/components/pom.xml
index ab32c00..8c1858c 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -258,6 +258,7 @@
         <module>camel-paho</module>
         <module>camel-paxlogging</module>
         <module>camel-pdf</module>
+        <module>camel-pg-replication-slot</module>
         <module>camel-pgevent</module>
         <module>camel-printer</module>
         <module>camel-protobuf</module>
diff --git a/components/readme.adoc b/components/readme.adoc
index 6d4d649..9691ce0 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -664,6 +664,9 @@ Number of Components: 296 in 233 JAR artifacts (0 
deprecated)
 | link:camel-pdf/src/main/docs/pdf-component.adoc[PDF] (camel-pdf) +
 `pdf:operation` | 2.16 | The pdf components provides the ability to create, 
modify or extract content from PDF documents.
 
+| 
link:camel-pg-replication-slot/src/main/docs/pg-replication-slot-component.adoc[PostgresSQL
 Replication Slot] (camel-pg-replication-slot) +
+`pg-replication-slot:host:port/database/slot` | 2.25 | The pg-replication-slot 
component allows for consuming PostgreSQL Streaming Replication change events.
+
 | link:camel-pgevent/src/main/docs/pgevent-component.adoc[PostgresSQL Event] 
(camel-pgevent) +
 `pgevent:host:port/database/channel` | 2.15 | The pgevent component allows for 
producing/consuming PostgreSQL events related to the listen/notify commands.
 
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/PgReplicationSlotEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/PgReplicationSlotEndpointBuilderFactory.java
new file mode 100644
index 0000000..b08274e
--- /dev/null
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/PgReplicationSlotEndpointBuilderFactory.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.builder.endpoint.dsl;
+
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.builder.EndpointConsumerBuilder;
+import org.apache.camel.builder.EndpointProducerBuilder;
+import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
+
+/**
+ * Consumer endpoint to receive from PostgreSQL Replication Slot.
+ * 
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.EndpointDslMojo")
+public interface PgReplicationSlotEndpointBuilderFactory {
+
+
+    /**
+     * Builder for endpoint for the PostgresSQL Replication Slot component.
+     */
+    public interface PgReplicationSlotEndpointBuilder
+            extends
+                EndpointConsumerBuilder {
+        default AdvancedPgReplicationSlotEndpointBuilder advanced() {
+            return (AdvancedPgReplicationSlotEndpointBuilder) this;
+        }
+        /**
+         * Replication slot name.
+         * The option is a <code>java.lang.String</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder slot(String slot) {
+            setProperty("slot", slot);
+            return this;
+        }
+        /**
+         * PostgreSQL server host.
+         * The option is a <code>java.lang.String</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder host(String host) {
+            setProperty("host", host);
+            return this;
+        }
+        /**
+         * PostgreSQL server port.
+         * The option is a <code>java.lang.Integer</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder port(Integer port) {
+            setProperty("port", port);
+            return this;
+        }
+        /**
+         * PostgreSQL server port.
+         * The option will be converted to a <code>java.lang.Integer</code>
+         * type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder port(String port) {
+            setProperty("port", port);
+            return this;
+        }
+        /**
+         * PostgreSQL database name.
+         * The option is a <code>java.lang.String</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder database(String database) {
+            setProperty("database", database);
+            return this;
+        }
+        /**
+         * Output plugin name (e.g. test_decoding, wal2json).
+         * The option is a <code>java.lang.String</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder outputPlugin(
+                String outputPlugin) {
+            setProperty("outputPlugin", outputPlugin);
+            return this;
+        }
+        /**
+         * PostgreSQL password.
+         * The option is a <code>java.lang.String</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder password(String password) {
+            setProperty("password", password);
+            return this;
+        }
+        /**
+         * PostgreSQL username.
+         * The option is a <code>java.lang.String</code> type.
+         * @group common
+         */
+        default PgReplicationSlotEndpointBuilder user(String user) {
+            setProperty("user", user);
+            return this;
+        }
+    }
+
+    /**
+     * Advanced builder for endpoint for the PostgresSQL Replication Slot
+     * component.
+     */
+    public interface AdvancedPgReplicationSlotEndpointBuilder
+            extends
+                EndpointConsumerBuilder {
+        default PgReplicationSlotEndpointBuilder basic() {
+            return (PgReplicationSlotEndpointBuilder) this;
+        }
+        /**
+         * Auto create slot if it does not exist.
+         * The option is a <code>java.lang.Boolean</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder autoCreateSlot(
+                Boolean autoCreateSlot) {
+            setProperty("autoCreateSlot", autoCreateSlot);
+            return this;
+        }
+        /**
+         * Auto create slot if it does not exist.
+         * The option will be converted to a <code>java.lang.Boolean</code>
+         * type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder autoCreateSlot(
+                String autoCreateSlot) {
+            setProperty("autoCreateSlot", autoCreateSlot);
+            return this;
+        }
+        /**
+         * Whether the endpoint should use basic property binding (Camel 2.x) 
or
+         * the newer property binding with additional capabilities.
+         * The option is a <code>boolean</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder basicPropertyBinding(
+                boolean basicPropertyBinding) {
+            setProperty("basicPropertyBinding", basicPropertyBinding);
+            return this;
+        }
+        /**
+         * Whether the endpoint should use basic property binding (Camel 2.x) 
or
+         * the newer property binding with additional capabilities.
+         * The option will be converted to a <code>boolean</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder basicPropertyBinding(
+                String basicPropertyBinding) {
+            setProperty("basicPropertyBinding", basicPropertyBinding);
+            return this;
+        }
+        /**
+         * Slot options to be passed to the output plugin.
+         * The option is a <code>java.util.Map&lt;java.lang.String,
+         * java.lang.Object&gt;</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder slotOptions(
+                Map<String, Object> slotOptions) {
+            setProperty("slotOptions", slotOptions);
+            return this;
+        }
+        /**
+         * Slot options to be passed to the output plugin.
+         * The option will be converted to a
+         * <code>java.util.Map&lt;java.lang.String, java.lang.Object&gt;</code>
+         * type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder slotOptions(
+                String slotOptions) {
+            setProperty("slotOptions", slotOptions);
+            return this;
+        }
+        /**
+         * Specifies the number of seconds between status packets sent back to
+         * Postgres server.
+         * The option is a <code>java.lang.Integer</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder statusInterval(
+                Integer statusInterval) {
+            setProperty("statusInterval", statusInterval);
+            return this;
+        }
+        /**
+         * Specifies the number of seconds between status packets sent back to
+         * Postgres server.
+         * The option will be converted to a <code>java.lang.Integer</code>
+         * type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder statusInterval(
+                String statusInterval) {
+            setProperty("statusInterval", statusInterval);
+            return this;
+        }
+        /**
+         * Sets whether synchronous processing should be strictly used, or 
Camel
+         * is allowed to use asynchronous processing (if supported).
+         * The option is a <code>boolean</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder synchronous(
+                boolean synchronous) {
+            setProperty("synchronous", synchronous);
+            return this;
+        }
+        /**
+         * Sets whether synchronous processing should be strictly used, or 
Camel
+         * is allowed to use asynchronous processing (if supported).
+         * The option will be converted to a <code>boolean</code> type.
+         * @group advanced
+         */
+        default AdvancedPgReplicationSlotEndpointBuilder synchronous(
+                String synchronous) {
+            setProperty("synchronous", synchronous);
+            return this;
+        }
+    }
+    /**
+     * Consumer endpoint to receive from PostgreSQL Replication Slot.
+     * Maven coordinates: org.apache.camel:camel-pg-replication-slot
+     */
+    default PgReplicationSlotEndpointBuilder pgReplicationSlot(String path) {
+        class PgReplicationSlotEndpointBuilderImpl extends 
AbstractEndpointBuilder implements PgReplicationSlotEndpointBuilder, 
AdvancedPgReplicationSlotEndpointBuilder {
+            public PgReplicationSlotEndpointBuilderImpl(String path) {
+                super("pg-replication-slot", path);
+            }
+        }
+        return new PgReplicationSlotEndpointBuilderImpl(path);
+    }
+}
\ No newline at end of file
diff --git a/parent/pom.xml b/parent/pom.xml
index 8b2d3a1..1e378c4 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -560,6 +560,7 @@
         <pax-tiny-bundle-version>1.3.2</pax-tiny-bundle-version>
         <pax-logging-version>1.8.6</pax-logging-version>
         <pdfbox-version>2.0.16</pdfbox-version>
+        <pgjdbc-driver-version>42.2.6</pgjdbc-driver-version>
         <pgjdbc-ng-driver-version>0.8.2</pgjdbc-ng-driver-version>
         
<properties-maven-plugin-version>1.0-alpha-2</properties-maven-plugin-version>
         <protobuf-version>3.7.1</protobuf-version>
@@ -1903,6 +1904,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pg-replication-slot</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-pgevent</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -3407,6 +3413,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pg-replication-slot-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-pgevent-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/platforms/karaf/features/src/main/resources/features.xml 
b/platforms/karaf/features/src/main/resources/features.xml
index da58a8a..419d14c 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1998,6 +1998,12 @@
     <bundle 
dependency='true'>mvn:org.apache.pdfbox/fontbox/${pdfbox-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-pdf/${project.version}</bundle>
   </feature>
+  <feature name='camel-pg-replication-slot' version='${project.version}' 
start-level='50'>
+    <feature version='${project.version}'>camel-core</feature>
+    <feature>jdbc</feature>
+    <bundle 
dependency='true'>mvn:org.postgresql/postgresql/${pgjdbc-driver-version}</bundle>
+    
<bundle>mvn:org.apache.camel/camel-pg-replication-slot/${project.version}</bundle>
+  </feature>
   <feature name='camel-pgevent' version='${project.version}' start-level='50'>
     <details>installing camel-pgevent may output an error in the log but it is 
installed correctly</details>
     <feature version='${project.version}'>camel-core</feature>
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/pom.xml
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/pom.xml
new file mode 100644
index 0000000..8f8dc11f
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-pg-replication-slot-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: PgReplicationSlot</name>
+  <description>Spring-Boot Starter for Component for receiving from PostgreSQL 
Replication Slots</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-pg-replication-slot</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <!--START OF GENERATED CODE-->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <!--END OF GENERATED CODE-->
+  </dependencies>
+</project>
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/java/org/apache/camel/component/pg/replication/slot/springboot/PgReplicationSlotComponentAutoConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/java/org/apache/camel/component/pg/replication/slot/springboot/PgReplicationSlotComponentAutoConfiguration.java
new file mode 100644
index 0000000..ac28d6b
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/java/org/apache/camel/component/pg/replication/slot/springboot/PgReplicationSlotComponentAutoConfiguration.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import 
org.apache.camel.component.pg.replication.slot.PgReplicationSlotComponent;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.ComponentConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import 
org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+        PgReplicationSlotComponentAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@EnableConfigurationProperties({ComponentConfigurationProperties.class,
+        PgReplicationSlotComponentConfiguration.class})
+public class PgReplicationSlotComponentAutoConfiguration {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(PgReplicationSlotComponentAutoConfiguration.class);
+    @Autowired
+    private ApplicationContext applicationContext;
+    @Autowired
+    private CamelContext camelContext;
+    @Autowired
+    private PgReplicationSlotComponentConfiguration configuration;
+    @Autowired(required = false)
+    private List<ComponentCustomizer<PgReplicationSlotComponent>> customizers;
+
+    static class GroupConditions extends GroupCondition {
+        public GroupConditions() {
+            super("camel.component", "camel.component.pg-replication-slot");
+        }
+    }
+
+    @Lazy
+    @Bean(name = "pg-replication-slot-component")
+    @ConditionalOnMissingBean(PgReplicationSlotComponent.class)
+    public PgReplicationSlotComponent configurePgReplicationSlotComponent()
+            throws Exception {
+        PgReplicationSlotComponent component = new 
PgReplicationSlotComponent();
+        component.setCamelContext(camelContext);
+        Map<String, Object> parameters = new HashMap<>();
+        IntrospectionSupport.getProperties(configuration, parameters, null,
+                false);
+        for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+            Object value = entry.getValue();
+            Class<?> paramClass = value.getClass();
+            if (paramClass.getName().endsWith("NestedConfiguration")) {
+                Class nestedClass = null;
+                try {
+                    nestedClass = (Class) paramClass.getDeclaredField(
+                            "CAMEL_NESTED_CLASS").get(null);
+                    HashMap<String, Object> nestedParameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(value, nestedParameters,
+                            null, false);
+                    Object nestedProperty = nestedClass.newInstance();
+                    CamelPropertiesHelper.setCamelProperties(camelContext,
+                            nestedProperty, nestedParameters, false);
+                    entry.setValue(nestedProperty);
+                } catch (NoSuchFieldException e) {
+                }
+            }
+        }
+        CamelPropertiesHelper.setCamelProperties(camelContext, component,
+                parameters, false);
+        if (ObjectHelper.isNotEmpty(customizers)) {
+            for (ComponentCustomizer<PgReplicationSlotComponent> customizer : 
customizers) {
+                boolean useCustomizer = (customizer instanceof HasId)
+                        ? HierarchicalPropertiesEvaluator.evaluate(
+                                applicationContext.getEnvironment(),
+                                "camel.component.customizer",
+                                
"camel.component.pg-replication-slot.customizer",
+                                ((HasId) customizer).getId())
+                        : HierarchicalPropertiesEvaluator.evaluate(
+                                applicationContext.getEnvironment(),
+                                "camel.component.customizer",
+                                
"camel.component.pg-replication-slot.customizer");
+                if (useCustomizer) {
+                    LOGGER.debug("Configure component {}, with customizer {}",
+                            component, customizer);
+                    customizer.customize(component);
+                }
+            }
+        }
+        return component;
+    }
+}
\ No newline at end of file
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/java/org/apache/camel/component/pg/replication/slot/springboot/PgReplicationSlotComponentConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/java/org/apache/camel/component/pg/replication/slot/springboot/PgReplicationSlotComponentConfiguration.java
new file mode 100644
index 0000000..68bff0a
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/java/org/apache/camel/component/pg/replication/slot/springboot/PgReplicationSlotComponentConfiguration.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pg.replication.slot.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Consumer endpoint to receive from PostgreSQL Replication Slot.
+ * 
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.component.pg-replication-slot")
+public class PgReplicationSlotComponentConfiguration
+        extends
+            ComponentConfigurationPropertiesCommon {
+
+    /**
+     * Whether to enable auto configuration of the pg-replication-slot
+     * component. This is enabled by default.
+     */
+    private Boolean enabled;
+    /**
+     * Whether the component should resolve property placeholders on itself 
when
+     * starting. Only properties which are of String type can use property
+     * placeholders.
+     */
+    private Boolean resolvePropertyPlaceholders = true;
+    /**
+     * Whether the component should use basic property binding (Camel 2.x) or
+     * the newer property binding with additional capabilities
+     */
+    private Boolean basicPropertyBinding = false;
+
+    public Boolean getResolvePropertyPlaceholders() {
+        return resolvePropertyPlaceholders;
+    }
+
+    public void setResolvePropertyPlaceholders(
+            Boolean resolvePropertyPlaceholders) {
+        this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+    }
+
+    public Boolean getBasicPropertyBinding() {
+        return basicPropertyBinding;
+    }
+
+    public void setBasicPropertyBinding(Boolean basicPropertyBinding) {
+        this.basicPropertyBinding = basicPropertyBinding;
+    }
+}
\ No newline at end of file
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/LICENSE.txt
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/NOTICE.txt
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000..c04b84b
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+  "properties": [
+    {
+      "defaultValue": true,
+      "name": "camel.component.pg-replication-slot.enabled",
+      "description": "Enable pg-replication-slot component",
+      "type": "java.lang.Boolean"
+    }
+  ]
+}
\ No newline at end of file
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/spring.factories
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..c0ad48a
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.component.pg.replication.slot.springboot.PgReplicationSlotComponentAutoConfiguration
diff --git 
a/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/spring.provides
 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..23402b2
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-pg-replication-slot-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+provides: camel-pg-replication-slot
diff --git a/platforms/spring-boot/components-starter/pom.xml 
b/platforms/spring-boot/components-starter/pom.xml
index 718f6fd..2b28912 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -292,6 +292,7 @@
     <module>camel-optaplanner-starter</module>
     <module>camel-paho-starter</module>
     <module>camel-pdf-starter</module>
+    <module>camel-pg-replication-slot-starter</module>
     <module>camel-pgevent-starter</module>
     <module>camel-printer-starter</module>
     <module>camel-properties-starter</module>
diff --git 
a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml 
b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 8d4fc21..1beb9a1 100644
--- 
a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ 
b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -2340,6 +2340,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pg-replication-slot</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-pg-replication-slot-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-pgevent</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git 
a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPgReplicationSlotTest.java
 
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPgReplicationSlotTest.java
new file mode 100644
index 0000000..9859338
--- /dev/null
+++ 
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPgReplicationSlotTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.karaf;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelPgReplicationSlotTest extends BaseKarafTest {
+
+    public static final String COMPONENT = 
extractName(CamelPgReplicationSlotTest.class);
+
+    @Test
+    public void test() throws Exception {
+        testComponent(COMPONENT);
+    }
+
+
+}
\ No newline at end of file
diff --git 
a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelPgReplicationSlotTest.java
 
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelPgReplicationSlotTest.java
new file mode 100644
index 0000000..e3d1ecd
--- /dev/null
+++ 
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelPgReplicationSlotTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.springboot;
+
+import org.apache.camel.itest.springboot.util.ArquillianPackager;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+@RunWith(Arquillian.class)
+public class CamelPgReplicationSlotTest extends AbstractSpringBootTestSupport {
+
+    @Deployment
+    public static Archive<?> createSpringBootPackage() throws Exception {
+        return ArquillianPackager.springBootPackage(createTestConfig());
+    }
+
+    public static ITestConfig createTestConfig() {
+        return new ITestConfigBuilder()
+                .module(inferModuleName(CamelPgReplicationSlotTest.class))
+                .unitTestExpectedNumber(0)
+                .build();
+    }
+
+    @Test
+    public void componentTests() throws Exception {
+        this.runComponentTest(config);
+        this.runModuleUnitTestsIfEnabled(config);
+    }
+
+
+}

Reply via email to