Giter Site home page Giter Site logo

root0109 / tablemodifyevent Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.18 MB

Mysql Database notifies java application when a record has changed.

Home Page: https://medium.com/@vaibhav0109/cache-refreshing-techniques-446403de1ba2

License: MIT License

Java 32.36% C 67.64%
mysql udf-libraries mysql-database java-8 rabbitmq java ipc interprocess-communication

tablemodifyevent's Introduction

TableModifyEvent

Mysql Database notifies java application when a record has changed.

Requirements: Java 8

Ubuntu 14.04 or greater

Run Steps :

  1. Generate the header file :

$ /usr/lib/jvm/jdk1.8.0_92/bin/javah -classpath ./:../lib/jna/jna.jar:../lib/rabbitmq/rabbitmq-client-2.8.4.jar -jni my.test.TableEventReader

  1. Rename generated header File

$ mv my_test_TableEventReader.h TableEventReader.h

  1. create tme.so

$ gcc -o tme.so -shared -Wl,-soname,libnative.so -I/usr/lib/jvm/jdk1.8.0_92/include -I/usr/lib/jvm/jdk1.8.0_92/include/linux tme.c -static -lc

#if above fails , try running below

$ gcc -o tme.so -shared -Wl,-soname,libnative.so -I/usr/lib/jvm/jdk1.8.0_92/include -I/usr/lib/jvm/jdk1.8.0_92/include/linux tme.c -lc -fPIC

  1. create db_modify_event.so

$ gcc $(mysql_config --cflags) -I/usr/lib/jvm/jdk1.8.0_92/include -I/usr/lib/jvm/jdk1.8.0_92/include/linux -shared -fPIC -o db_modify_event.so db_modify_event.c

  1. Copy db_modify_event.so to Mysql plugin directory

  2. Then on mysql prompt execute :

    drop function IF EXISTS db_modify_event ;

    CREATE FUNCTION db_modify_event RETURNS INT SONAME 'db_modify_event.so';

    select db_modify_event('topic','data');

  3. Check is function created or not using -> select * from mysql.func;

  4. Copy tme.so to /var/tmp/MYSQL_UDF

  5. Add the above path to tomcat in its init script as

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/tmp/MYSQL_UDF

tablemodifyevent's People

Contributors

root0109 avatar

Watchers

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