Plugins 在数据融合插件中实现节流
我正在开发一个数据融合转换插件,其工作原理如下: 配置:Plugins 在数据融合插件中实现节流,plugins,throttling,google-cloud-data-fusion,Plugins,Throttling,Google Cloud Data Fusion,我正在开发一个数据融合转换插件,其工作原理如下: 配置: url = "http://someUrl/with/some/{placeholder}" urlVariable = ("placeholder" => "inputFieldName") 处理: fieldValue = value of field "inputFieldName" in input data processedURL = Re
url = "http://someUrl/with/some/{placeholder}"
urlVariable = ("placeholder" => "inputFieldName")
处理:
fieldValue = value of field "inputFieldName" in input data
processedURL = Replace placeholder "{placeholder}" in url by fieldValue
ouput = execute http Get on the new URL
emmit the output data
现在我想在此插件上添加一个限制选项,以限制每秒发送的消息数
我知道如何使用com.google.common.util.concurrent.RateLimiter
实现节流,如果需要,可以调用.acquire()
函数等待发送
但在数据融合插件的上下文中,代码在Dataproc上并行执行。在这种情况下,节流将不起作用
如何在插件中实现节流