Skip to content
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

support openfunction framework #1

Merged
merged 3 commits into from
Jun 27, 2022
Merged

Conversation

wanjunlei
Copy link
Member

No description provided.

@CLAassistant
Copy link

CLAassistant commented Jun 22, 2022

CLA assistant check
All committers have signed the CLA.

@wanjunlei wanjunlei force-pushed the java branch 3 times, most recently from e006336 to 1d93736 Compare June 22, 2022 03:53
Signed-off-by: wanjunlei@kubesphere.io
Signed-off-by: wanjunlei <wanjunlei@kubesphere.io>
Signed-off-by: wanjunlei <wanjunlei@kubesphere.io>
Signed-off-by: wanjunlei <wanjunlei@kubesphere.io>
* @param data Data String
* @return Error
*/
Error send(String outputName, String data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenFunction/functions-framework#21 (comment)
we need to add publish for pubsub and output for binding.
You can add this in another PR


private static final Logger logger = Logger.getLogger("dev.openfunction.invoker");

private static final Map<String, Boolean> bindingQueueComponents = Map.of(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this hardcode bindingqueuecomponents is only used to determine if it's tracable?
@tpiperatgod Go FF has similar logic or use something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is similar to the go framework.
https://github.com/OpenFunction/functions-framework-go/blob/main/context/context.go#L25

At present, the tracing is not implemented, and it will be redesigned in the future.

@@ -0,0 +1,50 @@
apiVersion: core.openfunction.io/v1beta1
kind: Function
metadata:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move these samples to the samples repo later and update docs like https://openfunction.dev/docs/getting-started/quickstarts/ and https://openfunction.dev/docs/concepts/function_signatures/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The samples and docs will be completed later.

import java.util.logging.Level;
import java.util.logging.Logger;

public class UserContext implements Context {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the UserContext can just be renamed to Context including class name and filename and variable name(lowercase)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not conform to java's naming convention, interface implementation should not have the same name as the interface.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we can use FuncContext instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has a class named FunctionContex.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between FunctionContex and UserContext?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FunctionContex is the structure of FUNC_CONTEXT, UserContext implement the Context interface and will pass to the function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's ok if user function can only see context interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants