forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b64f6e
commit 205fc41
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...starts/quarkus/singleton-examples/google-cloud-functions-example/base/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Google Cloud Functions Integration examples | ||
|
||
Examples of Google Cloud HTTP and Background Functions for Quarkus. | ||
|
||
Guide: https://quarkus.io/guides/gcp-functions | ||
|
||
Two examples have been generated under `src/main/java/org/acme/googlecloudfunctions`, you must remove them before deploying to | ||
Google Cloud Functions or setup multi-functions support, see https://quarkus.io/guides/gcp-functions#choose-your-function. | ||
|
||
> :warning: **INCOMPATIBLE WITH DEV MODE**: Google Cloud Functions is not compatible with dev mode yet! |
10 changes: 10 additions & 0 deletions
10
...ources/codestarts/quarkus/singleton-examples/google-cloud-functions-example/codestart.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: google-cloud-functions-example | ||
ref: google-cloud-functions | ||
type: code | ||
tags: | ||
- example | ||
- singleton-example | ||
language: | ||
base: | ||
dependencies: | ||
- io.quarkus:quarkus-google-cloud-functions |
19 changes: 19 additions & 0 deletions
19
...xample/java/src/main/java/org/acme/googlecloudfunctions/HelloWorldBackgroundFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.acme.googlecloudfunctions; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import com.google.cloud.functions.BackgroundFunction; | ||
import com.google.cloud.functions.Context; | ||
|
||
@ApplicationScoped | ||
public class HelloWorldBackgroundFunction implements BackgroundFunction<HelloWorldBackgroundFunction.StorageEvent> { | ||
|
||
@Override | ||
public void accept(StorageEvent event, Context context) throws Exception { | ||
System.out.println("Receive event on file: " + event.name); | ||
} | ||
|
||
public static class StorageEvent { | ||
public String name; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ions-example/java/src/main/java/org/acme/googlecloudfunctions/HelloWorldHttpFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.acme.googlecloudfunctions; | ||
|
||
import java.io.Writer; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import com.google.cloud.functions.HttpFunction; | ||
import com.google.cloud.functions.HttpRequest; | ||
import com.google.cloud.functions.HttpResponse; | ||
|
||
@ApplicationScoped | ||
public class HelloWorldHttpFunction implements HttpFunction { | ||
|
||
@Override | ||
public void service(HttpRequest httpRequest, HttpResponse httpResponse) throws Exception { | ||
Writer writer = httpResponse.getWriter(); | ||
writer.write("Hello World"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters