Skip to content

Commit

Permalink
Add AWS funqy support
Browse files Browse the repository at this point in the history
  • Loading branch information
EzxD committed Dec 1, 2020
1 parent 92c14c2 commit 3a97b5b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 3 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ Our goal was to have functions with a low memory footprint and extremely fast co

> mvn package -Pnative -Dquarkus.native.container-build=true
## AWS
Specify your function in the ``application.properties`` with ``quarkus.funqy.export=helloWorld``.

The function name is based on the function in the ``HelloWorldFunction.class`` in the case it`s ``helloWorld``.

You need to add ``LAMBDA_ROLE_ARN`` with your role to your enviroment variables or add it to the ``manage.sh`` file.

### Native deployment

> mvn package -Pnative -Dquarkus.native.container-build=true
> sh target/manage.sh native create
## Testing
You can use the SAM CLI to test your aws lamda locally.

### JVM
> sam local invoke --template target/sam.jvm.yaml --event payload.json
### Native
> sam local invoke --template target/sam.native.yaml --event payload.json
## Sources

[Quarkus - Building native image](https://quarkus.io/guides/building-native-image)

[Quarkus - Funqy Amazon Lamda](https://quarkus.io/guides/funqy-amazon-lambda)
4 changes: 4 additions & 0 deletions payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"username": "testUser"

}
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<artifactId>quarkus-funqy-http</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-funqy-amazon-lambda</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class UserFunction {

@Inject
private UserService userSer;
UserService userSer;

@Funq
public void createUser(@Valid UserDTO userDTO) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class UserService {

@Inject
private UserRepository userRepository;
UserRepository userRepository;

@Transactional
public void createUser(String username) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
#quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/mydatabase
#quarkus.datasource.driver=org.postgresql.Driver
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.funqy.export=helloWorld
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class RepositoryTest {

@Inject
private UserRepository userRepository;
UserRepository userRepository;

@Test
@Transactional
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ quarkus.datasource.db-kind=h2
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.log.sql=true
quarkus.funqy.export=helloWorld

0 comments on commit 3a97b5b

Please sign in to comment.