-
Notifications
You must be signed in to change notification settings - Fork 65
Add logic to convert from Legacy Events to CloudEvents. #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This means functions that receive a CloudEvent payload and dispatch it to a user function that expects a CloudEvent object. We do not yet handle converting a CloudEvent payload to the form expected by legacy GCF functions.
This allows received Legacy Events to be handled by function code that expects a CloudEvent input. The translation logic and tests are based closely on the corresponding code in https://github.com/GoogleCloudPlatform/functions-framework-dotnet. The new code also passes the relevant conformance tests in https://github.com/GoogleCloudPlatform/functions-framework-conformance, once GoogleCloudPlatform/functions-framework-conformance#30 is applied. For now I'm running those tests manually. I plan at least to commit the script and test functions that allow me to do so.
|
My main concern here is about the |
Most of the testing is in https://github.com/GoogleCloudPlatform/functions-framework-dotnet/blob/master/src/Google.Cloud.Functions.Framework.Tests/GcfEvents/EventDeserializationTest.cs (and the test files in that directory) But for the actual shape of the CloudEvent, is your friend. |
jskeet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay to me, although there may well be subtleties that I've missed. I've added a comment for a simplification you can probably make.
There will be more Firestore/Firebase work to do in terms of source and subject - I'm hoping to get the proposed CloudEvent format finalized soon. (Will include you in the doc.)
invoker/core/src/main/java/com/google/cloud/functions/invoker/BackgroundFunctionExecutor.java
Outdated
Show resolved
Hide resolved
invoker/core/src/main/java/com/google/cloud/functions/invoker/BackgroundFunctionExecutor.java
Show resolved
Hide resolved
invoker/core/src/main/java/com/google/cloud/functions/invoker/CloudFunctionsContext.java
Show resolved
Hide resolved
invoker/core/src/main/java/com/google/cloud/functions/invoker/CloudFunctionsContext.java
Outdated
Show resolved
Hide resolved
invoker/core/src/main/java/com/google/cloud/functions/invoker/GcfEvents.java
Show resolved
Hide resolved
Oh, excellent! It looks as if I can get better test coverage just by translating that test to Java, which I'll do in a later change.
Is there a word missing here? |
|
Whoops - I could have sworn I copied the link. Doh. https://github.com/googleapis/google-cloudevents is the source of truth for the format of the data part within Google CloudEvents. (You may wish to consume that via https://github.com/googleapis/google-cloudevents-java when the code is published appropriately, in order to test the conversion.) |
This allows received Legacy Events to be handled by function code that expects a
CloudEvent input. The translation logic and tests are based closely on the
corresponding code in https://github.com/GoogleCloudPlatform/functions-framework-dotnet.
The new code also passes the relevant conformance tests in
https://github.com/GoogleCloudPlatform/functions-framework-conformance, once
GoogleCloudPlatform/functions-framework-conformance#30
is applied. For now I'm running those tests manually. I plan at least to commit
the script and test functions that allow me to do so.