因此,为了模拟2个事件,我向一个Forwarder发送一个事件,然后调用另外两个lambdas。为了使这种切换成功,我必须等待结果," InvokeResult result1 = resultFuture1.get();"
这意味着转发器必须等到其他lambda完成(并导致其他lambda的计费时间成本)。还有更好的方法吗?
public class Forwarder
public String runSingleConvert(S3MKVBucketInformation bucketInformation, Context context) {
AWSLambdaAsyncClient client = new AWSLambdaAsyncClient();
InvokeRequest request1 = new InvokeRequest();
request1.setFunctionName("Receiver1");
request1.setPayload(toByteBuffer(bucket, key));
Future<InvokeResult> resultFuture1 = client.invokeAsync(request1);
InvokeResult result1 = resultFuture1.get();
InvokeRequest request2 = new InvokeRequest();
request2.setFunctionName("Receiver2");
request2.setPayload(toByteBuffer(bucket, key));
Future<InvokeResult> resultFuture2 = client.invokeAsync(request2);
InvokeResult result2 = resultFuture2.get();