Coder Social home page Coder Social logo

account-transaction's Introduction

Account transactions

This example combines a kafka topic, a postgres database, the csv format and a rest endpoint, to simulate account transactions that will be queried through Rest.

Prerequisites

  1. A running Kafka cluster
  2. A running Postgresql database
  3. A database named transactions
  4. A table named transactions with the following structure
    Column name Data type
    id serial
    timestamp varchar
    account varchar
    amount float
CREATE TABLE transactions (
    "timestamp" character varying,
    account character varying,
    amount bigint,
    id integer NOT NULL
);

CREATE SEQUENCE transactions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE ONLY transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);

Workflow

The load is generated using the load-generator.camel.yaml file, which creates CSV-like records and submits it into a kafka topic.

Later on, the data-ingestion.camel.yaml file consume messages from that topic and stores it into a Postgres database.

How to run

  1. Open the data-ingestion.camel.yaml file and set the PostgresqlDataSource bean properties to match your Postgresql database, such as databaseName, user, password, serverName, and portNumber 1.1. This example expects to have a secret named postgres with the following keys: * database-name containing the database name * database-user containing the user name * database-password containing the password
  2. Since this example requires the Postgresql dependency, change to the account-transactions folder
cd account-transactions
  1. Run the integration using the Camel CLI extension, or by executing the following command:
jbang '-Dcamel.jbang.version=4.5.0' camel@apache/camel run * --dev --logging-level=info
  1. In another terminal, execute the following command to retrieve records
curl localhost:8080

account-transaction's People

Contributors

lordrip 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.