Skip to content

Commit

Permalink
Merge pull request #30114 from loicmathieu/gcf-java-17
Browse files Browse the repository at this point in the history
Use Java 17 runtime in the Google Cloud Functions guides
  • Loading branch information
geoand authored Jan 3, 2023
2 parents de7c624 + 6e52de0 commit e2898f7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 50 deletions.
26 changes: 7 additions & 19 deletions docs/src/main/asciidoc/funqy-gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ quarkus.funqy.export=helloPubSubWorld
To build your application, you can package your application via `mvn clean package`.
You will have a single JAR inside the `target/deployment` repository that contains your classes and all your dependencies in it.

Then you will be able to use `gcloud` to deploy your function to Google Cloud. The `gcloud` command will be different depending on which event you want to trigger.
Then you will be able to use `gcloud` to deploy your function to Google Cloud.
The `gcloud` command will be different depending on which event triggers your function.

NOTE: We will use the Java 17 runtime but you can switch to the Java 11 runtime by using `--runtime=java11` instead of `--runtime=java17` on the deploy commands.

[WARNING]
====
Expand All @@ -163,7 +166,7 @@ Use this command to deploy to Google Cloud Functions:
----
gcloud functions deploy quarkus-example-funky-pubsub \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyBackgroundFunction \
--runtime=java11 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish \
--runtime=java17 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish \
--source=target/deployment
----

Expand All @@ -173,11 +176,6 @@ The entry point always needs to be `io.quarkus.funqy.gcp.functions.FunqyBackgrou
that will bootstrap Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

The `--trigger-resource` option defines the name of the PubSub topic, and the `--trigger-event google.pubsub.topic.publish` option
define that this function will be triggered by all message publication inside the topic.

Expand Down Expand Up @@ -205,7 +203,7 @@ Then, use this command to deploy to Google Cloud Functions:
----
gcloud functions deploy quarkus-example-funky-storage \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyBackgroundFunction \
--runtime=java11 --trigger-resource quarkus-hello --trigger-event google.storage.object.finalize \
--runtime=java17 --trigger-resource quarkus-hello --trigger-event google.storage.object.finalize \
--source=target/deployment
----

Expand All @@ -215,11 +213,6 @@ The entry point always needs to be `io.quarkus.funqy.gcp.functions.FunqyBackgrou
that will bootstrap Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

The `--trigger-resource` option defines the name of the Cloud Storage bucket, and the `--trigger-event google.storage.object.finalize` option
define that this function will be triggered by all new file inside this bucket.

Expand Down Expand Up @@ -251,7 +244,7 @@ Then, use this command to deploy to Google Cloud Functions:
----
gcloud functions deploy quarkus-example-cloud-event --gen2 \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyCloudEventsFunction \
--runtime=java11 --trigger-bucket=example-cloud-event --source=target/deployment
--runtime=java17 --trigger-bucket=example-cloud-event --source=target/deployment
----

[IMPORTANT]
Expand All @@ -260,11 +253,6 @@ The entry point always needs to be `io.quarkus.funqy.gcp.functions.FunqyCloudEve
that will bootstrap Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

The `--trigger-bucket=` option defines the name of the Cloud Storage bucket.

To trigger the event, you can send a file to the GCS `example-cloud-event` bucket.
Expand Down
9 changes: 3 additions & 6 deletions docs/src/main/asciidoc/gcp-functions-http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,20 @@ The result of the previous command is a single JAR file inside the `target/deplo

Then you will be able to use `gcloud` to deploy your function to Google Cloud.

NOTE: We will use the Java 17 runtime but you can switch to the Java 11 runtime by using `--runtime=java11` instead of `--runtime=java17` on the deploy commands.

[source,bash]
----
gcloud functions deploy quarkus-example-http \
--entry-point=io.quarkus.gcp.functions.http.QuarkusHttpFunction \
--runtime=java11 --trigger-http --allow-unauthenticated --source=target/deployment
--runtime=java17 --trigger-http --allow-unauthenticated --source=target/deployment
----

[IMPORTANT]
====
The entry point must always be set to `io.quarkus.gcp.functions.http.QuarkusHttpFunction` as this is the class that integrates Cloud Functions with Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

[WARNING]
====
The first time you launch this command, you can have the following error message:
Expand Down
33 changes: 8 additions & 25 deletions docs/src/main/asciidoc/gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ include::{includes}/devtools/build.adoc[]

The result of the previous command is a single JAR file inside the `target/deployment` repository that contains classes and dependencies of the project.

Then you will be able to use `gcloud functions deploy` command to deploy your function to Google Cloud.
Then you will be able to use `gcloud` to deploy your function to Google Cloud.
The `gcloud` command will be different depending on which event triggers your function.

NOTE: We will use the Java 17 runtime but you can switch to the Java 11 runtime by using `--runtime=java11` instead of `--runtime=java17` on the deploy commands.

[WARNING]
====
Expand All @@ -257,19 +260,14 @@ This is an example command to deploy your `HttpFunction` to Google Cloud:
----
gcloud functions deploy quarkus-example-http \
--entry-point=io.quarkus.gcp.functions.QuarkusHttpFunction \
--runtime=java11 --trigger-http --allow-unauthenticated --source=target/deployment
--runtime=java17 --trigger-http --allow-unauthenticated --source=target/deployment
----

[IMPORTANT]
====
The entry point must always be set to `io.quarkus.gcp.functions.QuarkusHttpFunction` as this is the class that integrates Cloud Functions with Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

This command will give you as output a `httpsTrigger.url` that points to your function.

=== The BackgroundFunction
Expand All @@ -289,19 +287,14 @@ it needs to use `--trigger-event google.storage.object.finalize` and the `--trig
gcloud functions deploy quarkus-example-storage \
--entry-point=io.quarkus.gcp.functions.QuarkusBackgroundFunction \
--trigger-resource quarkus-hello --trigger-event google.storage.object.finalize \
--runtime=java11 --source=target/deployment
--runtime=java17 --source=target/deployment
----

[IMPORTANT]
====
The entry point must always be set to `io.quarkus.gcp.functions.QuarkusBackgroundFunction` as this is the class that integrates Cloud Functions with Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

To trigger the event, you can send a file to the GCS `quarkus-hello` bucket, or you can use gcloud to simulate one:

[source,bash]
Expand All @@ -320,19 +313,14 @@ it needs to use `--trigger-event google.pubsub.topic.publish` and the `--trigger
----
gcloud functions deploy quarkus-example-pubsub \
--entry-point=io.quarkus.gcp.functions.QuarkusBackgroundFunction \
--runtime=java11 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish --source=target/deployment
--runtime=java17 --trigger-resource hello_topic --trigger-event google.pubsub.topic.publish --source=target/deployment
----

[IMPORTANT]
====
The entry point must always be set to `io.quarkus.gcp.functions.QuarkusBackgroundFunction` as this is the class that integrates Cloud Functions with Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

To trigger the event, you can send a file to the `hello_topic` topic, or you can use gcloud to simulate one:

[source,bash]
Expand All @@ -351,19 +339,14 @@ it needs to use `--trigger-bucket` parameter with the name of a previously creat
----
gcloud functions deploy quarkus-example-cloud-event --gen2 \
--entry-point=io.quarkus.gcp.functions.QuarkusCloudEventsFunction \
--runtime=java11 --trigger-bucket=example-cloud-event --source=target/deployment
--runtime=java17 --trigger-bucket=example-cloud-event --source=target/deployment
----

[IMPORTANT]
====
The entry point must always be set to `io.quarkus.gcp.functions.QuarkusCloudEventsFunction` as this is the class that integrates Cloud Functions with Quarkus.
====

[NOTE]
====
You can also use the new Java 17 runtime by using `--runtime=java17` in the gcloud command line.
====

To trigger the event, you can send a file to the GCS `example-cloud-event` bucket.

== Running locally
Expand Down

0 comments on commit e2898f7

Please sign in to comment.