Git Product home page Git Product logo

sriram-ponangi / file-monitoring Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 61 KB

This application monitors events such as create, update, delete, etc. on a file/directory and then for each triggered event a series of actions/tasks are executed using the chain of responsibility design pattern.

Java 100.00%
spring-boot maven-multimodule maven commons-io commons-chain commandlinerunner java yaml

file-monitoring's Introduction

File-Monitoring Application:

  • This is a POC application to monitor events(Create, Update, Delete, etc.) to a file/directory and then for each triggered event execute a series of actions/tasks using the chain of responsibility pattern.

  • The directories to monitor and the task to be executed must be dynamically configurable by passing the configs file path either through VM args or application properties.

    • Example:
      • monitoring-config.yaml to configure the file monitoring events and the corresponding command chains to be executed.
      • chain-config.yml to configure the details of commands (command name, execution sequence, etc.) for each of the chains.

The solution is created using:

  • Spring Boot CommandLineRunner as this is a console application.
  • Maven Multi-Modules to split the code properly to ensure high cohesion.
  • Abstract Factory and Dependency Injection patterns to ensure low coupling.
  • The chain-of-responsibility design pattern.
  • Apache commons-io to capture the file monitoring events.
  • Log4j2 to efficiently manage the rolling of log files.
  • Creating multiple database connection that can be used with spring boot and hikaricp.
    • Jaspyt for encrypting database passwords.
      # Command To Start The Temporary DB In a Docker Container:
      #---------------------------------------------------------
      # docker pull mysql
      docker run --name mysql-locl -e MYSQL_ROOT_PASSWORD=default -v $HOME/mysql/data:/var/lib/mysql -p 33060:3306 -d mysql
      
      #docker pull ibmcom/db2
      docker run -itd --name db2-locl --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=default -e DBNAME=testdb -v $HOME/db2/data:/database ibmcom/db2

Deployment Instructions:

  • Run the application using the command:

    java -jar file-monitoring-0.0.1-SNAPSHOT.jar
    
  • You can also provide the following optional VM-Args to the above command:

    -Dmonitoring-events.config.yml.path=/c/Users/lenovo/Desktop/monitoring-config.yaml
    
    -Dchain.config.yml.path=/c/Users/lenovo/Desktop/chain-config.yaml
    
    -Dfile.monitoring.app.logs.path=/c/Users/lenovo/Desktop/logs
    
    -Dfile.monitoring.app.logs.level=info
    
  • The command to run the application with all the optional VM args:

    java -jar -Dchain.config.yml.path=/c/Users/lenovo/Desktop/chain-config.yaml -Dmonitoring-events.config.yml.path=/c/Users/lenovo/Desktop/monitoring-config.yaml -Dfile.monitoring.app.logs.path=/c/Users/lenovo/Desktop/logs -Dfile.monitoring.app.logs.level=info file-monitoring-0.0.1-SNAPSHOT.jar

file-monitoring's People

Contributors

sriram-ponangi 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.