Skip to content

Commit 3a97b5b

Browse files
committed
Add AWS funqy support
1 parent 92c14c2 commit 3a97b5b

8 files changed

Lines changed: 37 additions & 3 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ Our goal was to have functions with a low memory footprint and extremely fast co
66

77
> mvn package -Pnative -Dquarkus.native.container-build=true
88
9+
## AWS
10+
Specify your function in the ``application.properties`` with ``quarkus.funqy.export=helloWorld``.
11+
12+
The function name is based on the function in the ``HelloWorldFunction.class`` in the case it`s ``helloWorld``.
13+
14+
You need to add ``LAMBDA_ROLE_ARN`` with your role to your enviroment variables or add it to the ``manage.sh`` file.
15+
16+
### Native deployment
17+
18+
> mvn package -Pnative -Dquarkus.native.container-build=true
19+
20+
> sh target/manage.sh native create
21+
22+
## Testing
23+
You can use the SAM CLI to test your aws lamda locally.
24+
25+
### JVM
26+
> sam local invoke --template target/sam.jvm.yaml --event payload.json
27+
28+
### Native
29+
> sam local invoke --template target/sam.native.yaml --event payload.json
30+
931
## Sources
1032

1133
[Quarkus - Building native image](https://quarkus.io/guides/building-native-image)
34+
35+
[Quarkus - Funqy Amazon Lamda](https://quarkus.io/guides/funqy-amazon-lambda)

payload.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"username": "testUser"
3+
4+
}

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
<artifactId>quarkus-funqy-http</artifactId>
4343
<scope>compile</scope>
4444
</dependency>
45+
<dependency>
46+
<groupId>io.quarkus</groupId>
47+
<artifactId>quarkus-funqy-amazon-lambda</artifactId>
48+
</dependency>
4549
<dependency>
4650
<groupId>io.quarkus</groupId>
4751
<artifactId>quarkus-resteasy</artifactId>

src/main/java/de/stvehb/example/serverless/function/UserFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class UserFunction {
1111

1212
@Inject
13-
private UserService userSer;
13+
UserService userSer;
1414

1515
@Funq
1616
public void createUser(@Valid UserDTO userDTO) {

src/main/java/de/stvehb/example/serverless/service/UserService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
public class UserService {
1212

1313
@Inject
14-
private UserRepository userRepository;
14+
UserRepository userRepository;
1515

1616
@Transactional
1717
public void createUser(String username) {

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
#quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/mydatabase
55
#quarkus.datasource.driver=org.postgresql.Driver
66
quarkus.hibernate-orm.database.generation=drop-and-create
7+
quarkus.funqy.export=helloWorld

src/test/java/de/stvehb/example/serverless/test/unit/repository/RepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
public class RepositoryTest {
2323

2424
@Inject
25-
private UserRepository userRepository;
25+
UserRepository userRepository;
2626

2727
@Test
2828
@Transactional

src/test/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ quarkus.datasource.db-kind=h2
22
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test
33
quarkus.hibernate-orm.database.generation=drop-and-create
44
quarkus.hibernate-orm.log.sql=true
5+
quarkus.funqy.export=helloWorld

0 commit comments

Comments
 (0)