Skip to content

jphaugla/Redisearch-Digital-Banking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redisearch-Digital-Banking

Provides a quick-start example of using Redis with springBoot with Banking structures. Digital Banking uses an API microservices approach to enable high speed requests for account, customer and transaction information. As seen below, this data is useful for a variety of business purposes in the bank.

Note: This is the same as Redis-Digital-Banking but will not use any Spring crudrepository indexes. Instead redisearch 2.0 indexes will be used. This is still using the crudrepository for the basic redis data.

Overview

In this tutorial, a java spring boot application is run through a jar file to support typical API calls to a REDIS banking data layer. A redis docker configuration is included.

Redis Advantages for Digital Banking

  • Redis easily handles high write transaction volume
  • Redis has no tombstone issues and can upsert posted transactions over pending
  • Redis Enterprise scales vertically (large nodes) and horizontally (many nodes)
  • Redisearch 2.0 automatically indexes the hash structure created by Spring Java CRUD repository

Requirements

  • Docker installed on your local system, see Docker Installation Instructions.
  • Alternatively, can run Redis Enterprise and set the redis host and port in the application.properties file
  • When using Docker for Mac or Docker for Windows, the default resources allocated to the linux VM running docker are 2GB RAM and 2 CPU's. Make sure to adjust these resources to meet the resource requirements for the containers you will be running. More information can be found here on adjusting the resources allocated to docker.

Docker for mac Docker for windows

Links that help!

Technical Overview

This github java code uses the mesclun library for redis modules. The mesclun library supports RediSearch, RedisGears, and RedisTimeSeries. The original github only used spring java without redisearch. That repository is still intact at this github location All of the Spring Java indexes have been removed in this version.

The spring java code

This is basic spring links

  • Spring Redis
  • boot-Contains index creation for each of the four redisearch indexes used in this solution: Account, Customer, Merchant, and Transaction
  • config-Initial configuration module using autoconfiguration and a threadpool sizing to adjust based on machine size
  • controller-http API call interfaces
  • data-code to generate POC type of customer, account, and transaction code
  • domain-has each of the java objects with their columns. Enables all the getter/setter methods
  • repository-has CRUD repository definitions. With transition to redisearch 2.0, not used as heavily as previously. This is where the redistemplate code is added if crud repository is no longer used.
  • service-asyncservice and bankservice doing the interaction with redis

The java code demonstrates common API actions with the data layer in REDIS. The java spring Boot framework minimizes the amount of code to build and maintain this solution. Maven is used to build the java code and the code is deployed to the tomcat server.

Data Structures in use

Getting Started

  1. Prepare Docker environment-see the Prerequisites section above...
  2. Pull this github into a directory
git clone https://github.com/jphaugla/Redisearch-Digital-Banking.git
  1. Refer to the notes for redis Docker images used but don't get too bogged down as docker compose handles everything except for a few admin steps on tomcat.
  1. Open terminal and change to the github home where you will see the docker-compose.yml file, then:
docker-compose up -d

To execute the code

(Alternatively, this can be run through intelli4j)

  1. Compile the code
mvn package
  1. run the jar file.
java -jar target/redis-0.0.1-SNAPSHOT.jar
  1. Test the application from a separate terminal window. This script uses an API call to generate sample banking customers, accounts and transactions. It uses Spring ASYNC techniques to generate higher load. A flag chooses between running the transactions pipelined in Redis or in normal non-pipelined method.
./scripts/generateData.sh

Shows a benchmark test run of generateData.sh on GCP servers. Although, this test run is using redisearch 1.0 code base. Need to rerun this test.

  1. Investigate the APIs in ./scripts. Adding the redisearch queries behind each script here also...
  • addTag.sh - add a tag to a transaction. Tags allow user to mark transactions to be in a buckets such as Travel or Food for budgetary tracking purposes
  • generateData.sh - simple API to generate default customer, accounts, merchants, phone numbers, emails and transactions
  • generateLots.sh - for server testing to generate higher load levels. Use with startAppservers.sh. Not for use with docker setup. This is load testing with redis enterprise and client application running in same network in the cloud.
  • getByAccount.sh - find transactions for an account between a date range
  • getByCreditCard.sh - find transactions for a credit card between a date range
  • getByCustID.sh - retrieve transactions for customer
  • getByEmail.sh - retrieve customer record using email address
  • getByMerchant.sh - find all transactions for an account from one merchant for date range
  • getByMerchantCategory.sh - find all transactions for an account from merchant category for date range
  • getByNamePhone.sh - get customers by phone and full name.
  • getByPhone.sh - get customers by phone only
  • getByStateCity.sh - get customers by city and state
  • getByZipLastname.sh - get customers by zipcode and lastname.
  • getReturns.sh - get returned transactions count by reason code
  • getTags.sh - get all tags on an account
  • getTaggedAccountTransactions.sh - find transactions for an account with a particular tag
  • getTransaction.sh - get one transaction by its transaction ID
  • getTransactionStatus.sh - see count of transactions by account status of PENDING, AUTHORIZED, SETTLED
  • saveAccount.sh - save a sample account
  • saveCustomer.sh - save a sample customer
  • saveTransaction.sh - save a sample Transaction
  • startAppservers.sh - start multiple app server instances for load testing
  • testPipeline.sh - test pipelining
  • updateTransactionStatus.sh - generate new transactions to move all transactions from one transaction Status up to the next transaction status. Parameter is target status. Can choose SETTLED or POSTED. Will move 100,000 transactions per call

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published