Code Monkey home page Code Monkey logo

quarkus-camel's Introduction

quarkus-camel

Creating and testing Camel routes with Quarkus.

Some components are from Quarkus Camel :

Additional components from regular Camel 3 :

  • file-watch
  • mock

Other stuff that are tested :

  • custom @QuarkusTestResource
  • inject TestContainers using @QuarkusTestResource

Pre-requisite 1 (S3 server and Postgres)

You need a Java 11 and Maven 3.6.2 to run this. You need to start S3 server (Minio) and PostgreSQL database before running like this :

cd docker
docker-compose up -d

Access Minio at : http://localhost:9000/minio/teedjay-bucket/

Pre-requisite 2 (Postgres with Debezium)

You need to manually start and configure a separate Postgres 12 database for Debezium usage. This database should have a test table with some data in it.

docker start postgres-debezium

Follow the commands below to start and cofigure postgres-debezium the first time (only once).

docker run --name postgres-debezium -p 5433:5432 -e POSTGRES_PASSWORD=postgres -d postgres:12

# https://github.com/debezium/debezium-examples/tree/master/auditlog
# docker exec -it postgres-debezium /bin/bash

(1) connect to postgres
docker exec -it postgres-debezium psql -U postgres

create table users
(
id serial not null constraint users_pk primary key,
username text,
config jsonb
);

insert into users(username, config) values ('ola', '{}');
insert into users(username, config) values ('bola', '{}');
insert into users(username, config) values ('jola', '{}');

alter table users owner to postgres;

ALTER SYSTEM SET wal_level = logical;
SHOW wal_level;

(2)
For wal level change to work, exit the psql and restart docker
docker restart postgres-debezium

(3) connect back to postgres and assert that wal_level is correct
docker exec -it postgres-debezium psql -U postgres
SHOW wal_level;

(3)
Also show old value
ALTER TABLE users REPLICA IDENTITY FULL;

There are 4 possible values for REPLICA IDENTITY:
DEFAULT - UPDATE and DELETE events will only contain the previous values for the primary key columns of a table
NOTHING - UPDATE and DELETE events will not contain any information about the previous value on any of the table columns
FULL - UPDATE and DELETE events will contain the previous values of all the table’s columns
INDEX index name - UPDATE and DELETE events will contains the previous values of the columns contained in the index definition named index name

Start in Quarkus dev mode

mvn clean quarkus:dev

Metrics

You get application metrics out of the box

http://localhost:8080/metrics/application

Camel Health

You get Readyness and Liveness probes out of the box from http://localhost:8080/health.

{
    "status": "UP",
    "checks": [
        {
            "name": "camel",
            "status": "UP",
            "data": {
                "contextStatus": "Started",
                "name": "camel-1"
            }
        },
        {
            "name": "camel-liveness-checks",
            "status": "UP",
            "data": {
                "route:route3": "UP",
                "route:route2": "UP",
                "route:route1": "UP"
            }
        },
        {
            "name": "camel",
            "status": "UP",
            "data": {
                "contextStatus": "Started",
                "name": "camel-1"
            }
        },
        {
            "name": "camel-readiness-checks",
            "status": "UP",
            "data": {
                "route:route3": "UP",
                "route:route2": "UP",
                "route:route1": "UP"
            }
        }
    ]
}

quarkus-camel's People

Contributors

teedjay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.