Not supported by Lightbend in any conceivable way, not open for contributions.
- Java 11 or later
- Apache Maven 3.6 or higher
- Kalix:
- Docker 20.10.8 or higher (engine and client)
- Docker Hub account (configured with Docker)
Access to thegcr.io/kalix-public
container registry
cURL
IDE / editor
mvn archetype:generate \
-DarchetypeGroupId=io.kalix \
-DarchetypeArtifactId=kalix-maven-archetype \
-DarchetypeVersion=LATEST
Define value for property 'groupId': com.example
Define value for property 'artifactId': loan-application
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.example: : com.example.loanapp
Delete:
src/main/proto/com/example/loanapp/counter_api.proto
src/main/proto/com/example/loanapp/domain/counter_domain.proto
Note: For code snippet insertion use command+J (MAC)
- Create file
loan_app_api.proto
insrc/main/proto/com/example/loanapp
folder. - Edit
src/main/proto/com/example/loanapp/loan_app_api.proto
in IDE - Insert header snippet:
aheader
- Insert commands snippet:
acmd
- Insert state snippet:
astate
- Insert service snippet:
asrv
- Add functions to service snippet (place cursor inside brackets
service LoanAppService { }
):afunc
- Create file
loan_app_domain.proto
insrc/main/proto/com/example/loanapp/domain
folder. - Edit
src/main/proto/com/example/loanapp/domain/loan_app_domain.proto
in IDE - Insert header snippet:
dheader
- Insert events snippet:
devts
- Insert state snippet:
dstate
- Edit
src/main/proto/com/example/loanapp/loan_app_api.proto
- Insert codegen annotations (place cursor under
service LoanAppService {
):acodegen
- Code generation (terminal):
mvn compile
- Refresh project (IDE)
- Trigger Maven sync (IDE)
- Edit
src/main/java/com/example/loanapp/domain/LoanAppEntity
class - Delete class body
- Insert code snippet (delete everything under constructor):
eall
- Edit
src/test/java/com/example/loanapp/domain/LoanAppEntityTest
class - Delete class body
- Insert code snippet:
ut
mvn test
- Edit
src/it/java/com/example/loanapp/LoanAppEntityIntegrationTest
class - Delete everything under the constructor
- Insert code snippet:
it
mvn -Pit verify
??
- Edit
pom.xml
and updatemy-docker-repo
in<dockerImage>my-docker-repo/${project.artifactId}</dockerImage>
- Execute in terminal:
mvn deploy
- Expose service:
kalix services expose loan-application
Service 'loan-application' was successfully exposed at: mute-fog-6388.us-east1.kalix.app
Note: mute-fog-6388.us-east1.kalix.app
is dedicated hostname for this service and is publicly accessible on Internet
- Submit loan application
curl -XPOST -d '{
"client_id": "1111",
"client_monthly_income_cents": 60000,
"loan_amount_cents": 20000,
"loan_duration_months": 12
}' https://mute-fog-6388.us-east1.kalix.app/loanapp/123456 -H "Content-Type: application/json"
- Get loan application:
curl -XGET https://mute-fog-6388.us-east1.kalix.app/loanapp/123456 -H "Content-Type: application/json"
- Approve:
curl -XPUT https://mute-fog-6388.us-east1.kalix.app/loanapp/123456/approve -H "Content-Type: application/json"
-
Create file
loan_app_topic.proto
insrc/main/proto/com/example/loanapp
folder. -
Edit
src/main/proto/com/example/loanapp/loan_app_topic.proto
in IDE -
Insert header snippet:
dheader
-
Insert events snippet:
devts
-
Insert service snippet:
dsrv
-
Insert functions snippet (place cursor inside brackets
service LoanAppToTopic { }
):dfunc
-
Code generation (terminal):
mvn compile
- Refresh project (IDE)
- Trigger Maven sync (IDE)
- Edit
src/main/java/com/example/loanapp/LoanAppToTopicAction
class - Delete class body
- Insert code snippet:
tall
mvn archetype:generate \
-DarchetypeGroupId=io.kalix \
-DarchetypeArtifactId=kalix-maven-archetype \
-DarchetypeVersion=LATEST
com.example
loan-application
com.example.loanapp
loan_app_api.proto
loan_app_domain.proto
mvn compile
mvn test
mvn -Pit verify
mvn deploy
curl -XPOST -d '{
"client_id": "1111",
"client_monthly_income_cents": 60000,
"loan_amount_cents": 20000,
"loan_duration_months": 12
}' https://mute-fog-6388.us-east1.kalix.app/loanapp/1 -H "Content-Type: application/json"
curl -XGET https://mute-fog-6388.us-east1.kalix.app/loanapp/1 -H "Content-Type: application/json"
curl -XPUT https://mute-fog-6388.us-east1.kalix.app/loanapp/1/approve -H "Content-Type: application/json"
loan_app_topic.proto