Improved orchestrator and activity input/output handling
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các interface TaskOrchestration và TaskActivity, cùng các ví dụ integration-test được tham chiếu trong issue. Theo dõi cách các đầu vào và đầu ra hiện đang đi qua context, sau đó cập nhật mô hình lập trình để các triển khai nhận đầu vào có kiểu và trả về đầu ra như được minh họa; các integration test nên thể hiện cách sử dụng được đề xuất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
The current TaskOrchestration and TaskActivity interfaces require implementations to use the context object to receive inputs. Consider the following example (copied from the integration tests):
final String orchestratorName = "SingleActivity";
final String activityName = "Echo";
final String input = Instant.now().toString();
DurableTaskGrpcWorker worker = this.createWorkerBuilder()
.addOrchestrator(orchestratorName, ctx -> {
String activityInput = ctx.getInput(String.class);
String output = ctx.callActivity(activityName, activityInput, String.class).get();
ctx.complete(output);
})
.addActivity(activityName, ctx -> {
return String.format("Hello, %s!", ctx.getInput(String.class));
})
.buildAndStart();
This design, while it works, has a few issues:
- The fetching of inputs is not type-safe because the call to
ctx.getInput(String.class)could fail if the input isn't actually a string. - The call to
ctx.getInput()isn't intuitive, making the programming model harder for developers to learn. - The call to
ctx.complete(output)is both unintuitive and inconsistent with how activity functions are defined.
This issue tracks improving the programming model to make processing inputs and outputs more intuitive and type-safe.
Proposal
The proposal is to change these interface definitions so that a developer could write the following, simpler orchestration and activity implementations:
final String orchestratorName = "SingleActivity";
final String activityName = "Echo";
final String input = Instant.now().toString();
DurableTaskGrpcWorker worker = this.createWorkerBuilder()
.addOrchestrator(orchestratorName, (ctx, activityInput) -> {
return ctx.callActivity(activityName, activityInput, String.class).get();
})
.addActivity(activityName, (ctx, name) -> {
return String.format("Hello, %s!", name);
})
.buildAndStart();
The differences are:
- The orchestrator and activity functions have the input passed to them explicitly.
- The orchestrator can use the return value to set the output.
This results in a simpler, more intuitive programming model and is also consistent with the proposed C# programming model.
- Ngôn ngữ chính
- Java
- Star
- 29
- Fork
- 18
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/durabletask-java
-
Needs: Triage :mag:
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/durabletask-java#303 ·
-
RetryContext.lastAttemptNumber is inflated when retriable task is awaited via ctx.anyOf(...) Đang mởNeeds: Triage :mag:
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
microsoft/durabletask-java#290 · 2 bình luận ·
-
Needs: Triage :mag:
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/durabletask-java#285 ·
-
Needs: Triage :mag:
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
microsoft/durabletask-java#276 ·
-
Enhancement
microsoft/durabletask-java#274 · 1 reaction · 2 người được giao ·
Tất cả issue của microsoft/durabletask-java
Issue tương tự
-
Bug Java Platform: Java
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-java#6138 · 1 bình luận ·
-
bug needs triage p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 bình luận ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/rocketmq-dashboard#4654 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100