addu390 commented on issue #622:
URL: https://github.com/apache/flink-agents/issues/622#issuecomment-4503997374

   Hi @wenjin272 
   While going over the current state of where things stand after #631 and 
#670, the cross-language action mechanism seems to be almost there? A Python 
agent can do `add_action(JavaFunction(...))` and a Java agent can do 
`addAction(new PythonFunction(...))`, and the operator dispatches to the right 
side.
   
   Haven't tested, but something like the below should work:
   ```
   class MyAgent(Agent):
       def __init__(self):
           super().__init__()
           self.add_action(
               name="handle",
               events=["my_event"],
               func=JavaFunction(
                   qualname="com.example.Handlers",
                   method_name="handle",
                   parameter_types=["org.apache.flink.agents.api.Event",
                                    
"org.apache.flink.agents.api.context.RunnerContext"],
               ),
           )
   ```
   Is the goal to further simplify the contract (e.g. shorthand for the 
descriptor), or potentially add support to the `@Action` decorators so users 
don't have to construct `JavaFunction`/`PythonFunction` by hand?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to