简体   繁体   English

圣杯 AWS Eventbridge

[英]Chalice AWS Eventbridge

How do i create handler functions (lambdas) that trigger on custom events in a EventBridge event when using AWS Chalice ?使用 AWS Chalice 时,如何创建在 EventBridge 事件中触发自定义事件的处理函数 (lambdas)?

https://aws.github.io/chalice/index.html https://aws.github.io/chalice/index.html

Docs say they support Cloudwatch events.文档说他们支持 Cloudwatch 事件。 AWS docs say cloudwatch events is kinda the same as eventbridge. AWS 文档说 cloudwatch 事件有点像 eventbridge。

https://aws.github.io/chalice/topics/events.html?highlight=cloudwatch#cloudwatch-events https://aws.github.io/chalice/topics/events.html?highlight=cloudwatch#cloudwatch-events

But how do i create a handler for events in my eventbus ?但是我如何为我的 eventbus 中的事件创建一个处理程序?

Not sure if you have custom events or scheduled events.不确定您是否有自定义事件或预定事件。 If scheduled events then @me2resh provided the following samples on his great website: https://www.me2resh.com/posts/2020/05/05/aws-chalice-event-triggers.html如果安排了活动,那么@me2resh 在他的网站上提供了以下示例: https ://www.me2resh.com/posts/2020/05/05/aws-chalice-event-triggers.html

app = chalice.Chalice(app_name='chalice-scheduled-event-demo')

@app.schedule('cron(15 10 ? * 6L 2002-2005)')
def cron_handler(event):
    pass

@app.schedule('rate(5 minutes)')
def rate_handler(event):
    pass

@app.schedule(Rate(5, unit=Rate.MINUTES))
def rate_obj_handler(event):
    pass

@app.schedule(Cron(15, 10, '?', '*', '6L', '2002-2005'))
def cron_obj_handler(event):
    pass

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM