ppalaga commented on a change in pull request #1215:
URL: https://github.com/apache/camel-quarkus/pull/1215#discussion_r426857984



##########
File path: 
integration-tests/debezium-postgres/src/main/java/org/apache/camel/quarkus/component/debezium/postgres/it/DebeziumPostgresResource.java
##########
@@ -22,30 +22,33 @@
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
-import org.apache.camel.CamelContext;
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.Exchange;
 import org.jboss.logging.Logger;
 
 @Path("/debezium-postgres")
 @ApplicationScoped
 public class DebeziumPostgresResource {
 
+    public static final String DB_NAME = "postgresDB";
+    public static final String DB_USERNAME = "user";
+    public static final String DB_PASSWORD = "changeit";
+    public static final String PROPERTY_HOSTNAME = "quarkus.postgres.hostname";
+    public static final String PROPERTY_STORE_FILE = 
"quarkus.debezium.store.folder";
+    public static final String PROPERTY_PORT = "quarkus.postgres.port";
+
     private static final Logger LOG = 
Logger.getLogger(DebeziumPostgresResource.class);
 
-    private static final String COMPONENT_DEBEZIUM_POSTGRES = 
"debezium-postgres";
     @Inject
-    CamelContext context;
+    ConsumerTemplate consumerTemplate;
 
-    @Path("/load/component/debezium-postgres")
+    @Path("/getEvent")
     @GET
     @Produces(MediaType.TEXT_PLAIN)
-    public Response loadComponentDebeziumPostgres() throws Exception {
-        /* This is an autogenerated test */
-        if (context.getComponent(COMPONENT_DEBEZIUM_POSTGRES) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", 
COMPONENT_DEBEZIUM_POSTGRES);
-        return Response.status(500, COMPONENT_DEBEZIUM_POSTGRES + " could not 
be loaded from the Camel context").build();
+    public String getEvent() throws Exception {
+        final Exchange message = consumerTemplate.receive("direct:event", 
2000);
+        return message == null ? null : message.getIn().getBody(String.class);

Review comment:
       If something like the following works, we could remove the whole 
`DebeziumPostgresRouteBuilder` class and the direct Maven dependency:
   
   ```suggestion
           return consumerTemplate.receiveBody("debezium-postgres:localhost?"
                   + "databaseHostname={{" + 
DebeziumPostgresResource.PROPERTY_HOSTNAME + "}}"
                   + "&databasePort={{" + 
DebeziumPostgresResource.PROPERTY_PORT + "}}"
                   + "&databaseUser=" + DebeziumPostgresResource.DB_USERNAME
                   + "&databasePassword=" + DebeziumPostgresResource.DB_PASSWORD
                   + "&databaseDbname=" + DebeziumPostgresResource.DB_NAME
                   + "&databaseServerName=qa"
                   + "&offsetStorageFileName={{" + 
DebeziumPostgresResource.PROPERTY_STORE_FILE + "}}", 5000, String.class);
   ```




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to