dengjia 59e45cdc7c first fc with fake output: ReadOssTestDataHandler 1 сар өмнө
..
src 59e45cdc7c first fc with fake output: ReadOssTestDataHandler 1 сар өмнө
README-en.md f6f1436194 Initial commit 1 сар өмнө
README.md f6f1436194 Initial commit 1 сар өмнө
publish.yaml f6f1436194 Initial commit 1 сар өмнө

README-en.md

timer-trigger-fc-event-java11 help documentation

Preliminary preparation

Permission preparation

Using this item, verify that your operational account has the following product permissions/policies:

Service/Business Functional Computing
Permissions/Policies AliyunFCFullAccess

Code & Preview

  • :smiley_cat:source code
  • In order to successfully deploy this sample code, you need to provide the following parameters during the deployment process:
    • Region: You need to configure the region where your Function Compute service needs to be deployed through this parameter. The default value is cn-hangzhou (Hangzhou).
    • The geographic options available to you are:
      • cn-beijing (Beijing)
      • cn-hangzhou (Hangzhou)
      • cn-shanghai (Shanghai)
      • cn-qingdao (Qingdao)
      • cn-zhangjiakou (Zhangjiakou)
      • cn-huhehaote (Hohhot)
      • cn-shenzhen (Shenzhen)
      • cn-chengdu (Chengdu)
      • cn-hongkong (Hong Kong)
      • ap-southeast-1 (Singapore)
      • ap-southeast-2 (Sydney)
      • ap-southeast-3 (Kuala Lumpur)
      • ap-southeast-5 (Jakarta)
      • ap-northeast-1 (Tokyo)
      • eu-central-1 (Frankfurt)
      • eu-west-1 (London)
      • us-west-1 (Silicon Valley)
      • us-east-1 (Virginia)
      • ap-south-1 (Mumbai)
    • Service name: You need to name your Function Compute service. The service name can only contain letters, numbers, underscores and dashes. Cannot start with a number or a dash. The length is between 1-128, and the default value is timer-trigger-quick-start.
    • Function name: You need to name your function calculation function. The function name can only contain letters, numbers, underscores and dashes. Cannot start with a number or a dash. The length is between 1-64. The default is timer-trigger-event-function-java11.
    • Time trigger expression (cronExpression): You need to fill in the expression to trigger the function. The time trigger expression supports two settings: @every, cron expression. For example: @every 1m / @every 1h30m.
    • Input content (payLoad): represents the input content of the trigger event itself.

Deployment & Experience

  • Deploy via Serverless Devs Cli:

    • Install Serverless Devs Cli Developer Tools, and perform Authorization Information Configuration;
    • Initialize the project: s init timer-trigger-fc-event-java11 -d timer-trigger-fc-event-java11
    • Fill in the parameters described in the above modules
    • Enter the project and deploy the project: cd timer-trigger-fc-event-java11 && s deploy -y
  • local debugging

    • Enter the application project project and execute the following command: s invoke --event-file event-example/timer-fc-sample.json.
    • You can view the logs and results after the simulated event triggers the function.

      ========= FC invoke Logs begin =========
      FC Invoke Start RequestId: 7564db25-615e-4952-845a-9f923c33bc6b
      [Name] Register [com.aliyun.serverless.runtime.classloader.FunctionClassLoader@58372a00] as [com.aliyun.serverless.runtime.classloader.FunctionClassLoader@com.aliyun.serverless.runtime.classloader.FunctionClassLoader@/code/HelloFCJava- 1.0-SNAPSHOT.jar/code/original-HelloFCJava-1.0-SNAPSHOT.jar]: hash [d4d9f0d4] (normal mode)
      2022-08-03 13:39:30.816 [INFO] [7564db25-615e-4952-845a-9f923c33bc6b] triggerTime: 2022-07-29T10:02:58Z
      2022-08-03 13:39:30.816 [INFO] [7564db25-615e-4952-845a-9f923c33bc6b] triggerName: TestTimer
      2022-08-03 13:39:30.817 [INFO] [7564db25-615e-4952-845a-9f923c33bc6b] payload: TestPayload
      FC Invoke End RequestId: 7564db25-615e-4952-845a-9f923c33bc6b
      
      Duration: 222.05 ms, Billed Duration: 223 ms, Memory Size: 128 MB, Max Memory Used: 82.52 MB
      ========= FC invoke Logs end =========
      
      FC Invoke instanceId: c-62ea7a92-1ae386bb6d88454b9f58
      
      FC Invoke Result:
      Timer Payload: TestPayload
      
      
      End of method: invoke
      ````
      
      
      
      - End-to-end testing
      
      - Log in to the Function Compute console, find the function you just deployed, and view the `call log` (if the log is not activated, click one-click activation), and you can view that the function trigger log is triggered and printed at the corresponding time interval.
      
      The log is as follows:
      
      

      bash

c-62ea7b02-22d488e6b6-08-03 21:43:22FC Invoke Start RequestId: c7439fac-9c76-45f3-98e6-ae535f0d5e c-62ea7b02-22d488e6b6-08-03 21:43:22[Name] Register [com.aliyun.serverless.runtime.classloader.FunctionClassLoader@58372a00] as [com.aliyun.serverless.runtime.classloader.FunctionClassLoader@com.aliyun .serverless.runtime.classloader.FunctionClassLoader@/code/HelloFCJava-1.0-SNAPSHOT.jar/code/original-HelloFCJava-1.0-SNAPSHOT.jar]: hash d4d9f0d4 c-62ea7b02-22d488e6b6-08-03 21:43:222022-08-03 13:43:22.568 [INFO] [c7439fac-9c76-45f3-98e6-ae535f0d5e] triggerTime: 2022-08-03T1Z: 2022-08-03 c-62ea7b02-22d488e6b6-08-03 21:43:222022-08-03 13:43:22.568 [INFO] [c7439fac-9c76-45f3-98e6-ae535f0d5e] triggerName: timer c-62ea7b02-22d488e6b6-08-03 21:43:222022-08-03 13:43:22.568 [INFO] [c7439fac-9c76-45f3-98e6-ae535f0d5e] payload: TestPayload c-62ea7b02-22d488e6b6-08-03 21:43:22FC Invoke End RequestId

application details

This application is only used for learning and reference. You can carry out secondary development and improvement based on this project to realize your own business logic.

Developer Community

If you have feedback about bugs or future expectations, you can give feedback and exchange in Serverless Devs repo Issues. If you want to join our discussion group or keep up to date with the latest developments in FC components, you can do so through the following channels:

| | | | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | WeChat public account:`serverless` | WeChat assistant: `xiaojiangwh` | Dingding exchange group:`33947367` |