Note:- If You have already setup JAVA_17 then skip this step
- Java 17 Installation on macOS
brew tap homebrew/cask-versions brew install --cask temurin17
- Set JAVA_17 Env value. Follow step 2 here
How build & run this project?
Install and run DynamoDB on your local machine:
-
Install AWS CLI and Configure
- Install AWS CLI Run following commands
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg ./AWSCLIV2.pkg -target /
- To verify AWS CLI Run following commands
which aws
aws --version
- Configure AWS CLI
aws configure
- Enter AccessKey : "local"
- Enter SecretKey : "12345"
- Enter region : "us-west-2"
- Enter output : "json"
- Reference
- Install AWS CLI Run following commands
-
Install DynamoDB
- Download DynamoDB
- Extract downloaded file
- navigate to the directory where you extracted DynamoDBLocal.jar, and enter the following command.
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
- Verify DynamoDB
aws dynamodb list-tables --endpoint-url http://localhost:8000
- Create table for Ad
aws dynamodb create-table --cli-input-json file://ads-table-definition.json --endpoint-url http://localhost:8000
- Reference
-
Visualizing the DynamoDB Table data
- Download and Install NoSQL Workbench
- Open NoSQL Workbench and Setup DynamoDB local connection
- Click on
operation builder
- Click on
Add connection
- Click on
DynamoDB Local
- Click on
- Reference
There are a few options to run the application (from more flexible to least)
-
You can just use the SpringBoot run functionality that is default in IntelliJ or SpringTools in Eclipse.
-
Start the service with Maven.
mvn spring-boot:run -Dspring.profiles.active=local
-
Package the jar file and run it
mvn clean package
java -jar ./target/ads-service-exec.jar --spring.profiles.active=local
You can use your favourite gRPC client (e.g. BloomRPC)
Import path in BloomRPC
Then import .proto file
Sample Ad Data
{
"title": "Car sell",
"description": "TOYOTA",
"price": 300000.0,
"owner": "Hello",
"status": "LIVE"
}
{
"alg": "RS256",
"typ": "JWT"
}
Use local-ads-service-public.pem to encode the token on local machine.
Use Authorization in Metadata
{"Authorization": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTczOTkyMDUsImlhdCI6MTY5NzM5NTYwNSwiaXNzIjoid3d3LmFjbWUuY29tIiwic3ViIjoiZjFlMzNhYjMtMDI3Zi00N2M1LWJiMDctOGRkOGFiMzdhMmQzIn0.cAP9Tav4VxO_JDxh7gL4AIoFVUZbeC27wwz5NYb-AY2OLss_mmFZGzgDPazmNYrw2_OyjDJqrTicffxF3kvJQiRHuljg4YOC0XgTwDo7aaLvw9DJFSPU8UAdVYEHZsD_CicOBkizNZlWeeIg8BwmxD6_KQdd454v7Kefr_uagMw6JUWHcyn8YZ68JexNtAyVv4ImEGd4QHPKoli5a2iWDRiAJKHG5LpKPE2DZw0avH4b6CJISz5jmTjRkN2357MS6Zudj9Hee35lJGEDxMND9wXIlAcju6vgMCm02KnY56JcnbD5StvZhE5nKcoU7tA0Rh6XKAI73Du4pn-6W11trQ"}
Or you can use client id test to bypass authentication on local machine
{"client-id": "test"}