A demo shopping cart Java Akka Serverless

Overview

shopping-cart-java-akka-serverless

This project is an Akka Serverless service that demonstrates a simple shopping cart implemented as an Akka Serverless service. The project contains two shopping cart implementations. One implementation has a shopping cart component as a value entity. The second shopping cart implementation has a shopping cart component as an event sourced entity. Both shopping cart implementation have a functionally equivalent API.

Designing

While designing your service it is useful to read designing services

Developing

This project has a bare-bones skeleton service ready to go, but in order to adapt and extend it it may be useful to read up on developing services and in particular the Java section

Building

You can use Maven to build your project, which will also take care of generating code based on the .proto definitions:

mvn compile

Running Locally

In order to run your application locally, you must run the Akka Serverless proxy. The included docker-compose file contains the configuration required to run the proxy for a locally running application. It also contains the configuration to start a local Google Pub/Sub emulator that the Akka Serverless proxy will connect to. To start the proxy, run the following command from this directory:

docker-compose up

On Linux this requires Docker 20.10 or later (https://github.com/moby/moby/pull/40007), or for a USER_FUNCTION_HOST environment variable to be set manually.

docker-compose -f docker-compose.yml -f docker-compose.linux.yml up

To start the application locally, the exec-maven-plugin is used. Use the following command:

mvn compile exec:exec

With both the proxy and your application running, any defined endpoints should be available at http://localhost:9000. In addition to the defined gRPC interface, each method has a corresponding HTTP endpoint. Unless configured otherwise (see Transcoding HTTP), this endpoint accepts POST requests at the path /[package].[entity name]/[method]. For example, using curl:

> curl -XPOST -H "Content-Type: application/json" localhost:9000/io.example.CounterService/GetCurrentCounter -d '{"counterId": "foo"}'
The command handler for `GetCurrentCounter` is not implemented, yet

For example, using grpcurl:

> grpcurl -plaintext -d '{"counterId": "foo"}' localhost:9000 io.example.CounterService/GetCurrentCounter 
ERROR:
  Code: Unknown
  Message: The command handler for `GetCurrentCounter` is not implemented, yet

Note: The failure is to be expected if you have not yet provided an implementation of GetCurrentCounter in your entity.

Deploying

To deploy your service, install the akkasls CLI as documented in Setting up a local development environment and configure a Docker Registry to upload your docker image to.

You will need to update the dockerImage property in the pom.xml and refer to Configuring registries for more information on how to make your docker image available to Akka Serverless.

Finally you can or use the Akka Serverless Console to create a project and then deploy your service into the project either by using mvn deploy, through the akkasls CLI or via the web interface. When using mvn deploy, Maven will also conveniently package and publish your docker image prior to deployment.

You might also like...

Demo microservice architecture with Spring ,Spring Cloud Gateway , Spring Cloud config server , Eureuka , keycloak and Docker.

Demo microservice architecture with Spring ,Spring Cloud Gateway , Spring Cloud config server , Eureuka , keycloak and Docker.

spring-microservice Demo microservice architecture with Spring ,Spring Cloud Gateway , Spring Cloud config server , Eureuka , keycloak and Docker. Arc

Sep 13, 2022

Spring Boot ECommerce Demo

Spring Boot ECommerce Demo

springboot-ecommerce2 Things todo list Clone this repository: git clone https://github.com/hendisantika/springboot-ecommerce2.git Navigate to the fold

Aug 30, 2022

Microservices with Spring Boot and Kafka Demo Project

Microservices with Spring Boot and Kafka Demo Project

Example microservices showing how to use Kafka and Kafka Streams with Spring Boot on the example of distributed transactions implementations with the SAGA pattern

Jan 7, 2023

Spring testcontainers demo

Getting Started Reference Documentation For further reference, please consider the following sections: Official Apache Maven documentation Spring Boot

Feb 16, 2022

Spring-boot application to demo JVM HEAP and Native memory leak

Description This repo can be used as demo repo for finding memory leaks. Example spring-boot project to show how to find and fix JVM HEAP memory leak

Jul 22, 2022

The project is a simple vulnerability Demo environment written by SpringBoot

The project is a simple vulnerability Demo environment written by SpringBoot

The project is a simple vulnerability Demo environment written by SpringBoot. Here, I deliberately wrote a vulnerability environment where there are arbitrary file uploads, and then use the `scan` attribute in the loghack configuration file to cooperate with the logback vulnerability to implement RCE.

Dec 14, 2022

Demo for Dapr v1.x

Demo for Dapr v1.x 1. Demo Services dapr-demo-proto: protocol buffer definition, contains the generated code. dapr-demo-order: product java service, s

Mar 16, 2022

Demo Repo for our CDC-based Strangler Fig Pattern Session @ VoxxedDays Romania 2021

Strangler Fig Pattern Demo Build applications Before being able to spin up the docker-compose based demo environment please make sure to successfully

Feb 20, 2022

Spring for GraphQL demo project with a Vue frontend.

Spring Books - Hello GraphQL This is a demo project that will introduce you to [https://spring.io/projects/spring-graphql](Spring for GraphQL). The Sp

Dec 2, 2022
Owner
Hugh McKee
Hugh McKee
Shopping Example Application

MSA, Event Sourcing, Domain Driven Design example application written using Test-Driven Development - TDD and Inversion of Control and Dependency Injection with Quarkus written in Java

Ахунов Азат Ахматович 11 Sep 12, 2022
A high availability shopping(ecommerce) system using SpringBoot, Spring Cloud, Eureka Server, Spring Cloud Gateway, resillience4j, Kafka, Redis and MySQL.

High-availability-shopping-system A high availability shopping(ecommerce) system using SpringBoot, Spring Cloud, Eureka Server, Spring Cloud Gateway,

LeiH 1 Oct 26, 2022
Sample serverless application written in Java compiled with GraalVM native-image

Serverless GraalVM Demo This is a simple serverless application built in Java and uses the GraalVM native-image tool. It consists of an Amazon API Gat

AWS Samples 143 Dec 22, 2022
A cloud-native, serverless, scalable, cheap key-value store

Sleeper Introduction Sleeper is a serverless, cloud-native, log-structured merge tree based, scalable key-value store. It is designed to allow the ing

GCHQ 21 Dec 26, 2022
Geektime Todo is a demo todo project for Geektime column.

Geektime Todo 简介 这是《极客时间》专栏的 Todo 项目示例。 基本用法 生成 IDEA 工程 ./gradlew idea 检查 ./gradlew check 数据库迁移 ./gradlew flywayMigrate 生成构建产物 ./gradlew build 生成发布包 对

Zheng Ye 53 Oct 20, 2022
source code of the live coding demo for "Building resilient and scalable API backends with Apache Pulsar and Spring Reactive" talk held at ApacheCon@Home 2021

reactive-iot-backend The is the source code of the live coding demo for "Building resilient and scalable API backends with Apache Pulsar and Spring Re

Lari Hotari 4 Jan 13, 2022
Apache Log4j2 CVE-2021-44228 RCE Demo with RMI and LDAP

CVE-2021-44228-Demo 利用 CVE-2021-44228,通过 RMI 和 LDAP 两种方式远程注入代码的示例。 Exploit class from RMI Server loaded Hello, ${jndi:rmi://127.0.0.1:1099/exploit} Ex

Zhuang Ma 2 Dec 14, 2021
Representational State Transfer + Structured Query Language(RSQL): Demo application using RSQL parser to filter records based on provided condition(s)

Representational State Transfer + Structured Query Language: RSQL Demo application using RSQL parser to filter records based on provided condition(s)

Hardik Singh Behl 9 Nov 23, 2022
Hexagonal Architecture Demo Project about Ticketing and Payment

This project is a sample production-ready implementation for demonstrating the power of Hexagonal Architecture (aka Ports And Adapters Pattern) written in Java.

Alican Akkuş 382 Jan 1, 2023
A short demo of CVE-2021-44228

sample-ldap-exploit A short demo of CVE-2021-44228 Build $ mvn clean verify Run Attacker $ java \ -cp 'attacker/target/sample-attacker.jar:attacker

Philip Oswald 6 Oct 19, 2022