Code Monkey home page Code Monkey logo

fusepagination's Introduction

Fuse Pagination

When using Fuse to perform ETL from one database to another, a huge database with millions of columns will cause Fuse to run out of memory if all the records are selected at the same time. This pattern shows how to implement the pagination pattern to extract records by batch.

Installation of Fuse Bundle

In the Fuse shell, run the following command install -s mvn:com.redhat/postgres-postgres/0.0.1-SNAPSHOT

Camel Code Walkthrough

  1. On start of the route, the target database is purged using an SQL delete query and using Camel-JDBC to communicate to the database.

  2. The total count of the source database is retrieved

  3. The preparePagination function is invoked. The DBProcessor.java contains the contains 3 main functions. The preparePagination function sets the loopcount variable. This variable is used to iterate the retrieval of records by batches. The pageSize value should be set. Currently it is set at 2.

  4. Once the loop count is calculated, a Camel loop is implemented. In each loop, the Camel route queries the database with an offset and inserts the records into the target database. String sqlquery = "SELECT * FROM address_info LIMIT " + pageSize + " OFFSET " + pageSize*(int)exchange.getProperty("CamelLoopIndex");

  5. The insertion is done using a thread pool so that threads can insert the records in parallel. The threadpool value should be set. It is currently set at 10.

fusepagination's People

Watchers

James Cloos avatar Wayne  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.