This topic describes handlers and how to configure handlers in the Java runtime in Function Compute.
What is a handler?
A handler for a function in FC is the method that is used to process requests in function code. When a function is invoked, Function Compute uses the handler that you configured to process requests.
You can configure the Request Handler parameter in the Function Compute console. For functions in the Java language, the handler must be in the [Package name].[Class name]::[Method name]
format. For example, if the name of your package is example, the class type is HelloFC,
and method is handleRequest, the handler can be configured as example.HelloFC::handleRequest
.
Configure a handler
When you configure a handler, make sure that you follow the configuration specifications that are described in Function Compute. The configuration specifications vary based on the handler type.
Handlers are classified into event handlers and HTTP handlers. Event requests are generated by event sources, and HTTP requests are generated by HTTP triggers. For more information, see Function types.
For examples on how to configure a handler, see Event handlers and HTTP handlers.