Skip to content

Custom status support - #26

Merged
shreyas-gopalakrishna merged 5 commits into
mainfrom
shreyasg/custom-status
Apr 11, 2022
Merged

Custom status support#26
shreyas-gopalakrishna merged 5 commits into
mainfrom
shreyasg/custom-status

Conversation

@shreyas-gopalakrishna

Copy link
Copy Markdown
Member

Added support for custom status with integration test
resolves #7

Comment thread sdk/src/main/java/com/microsoft/durabletask/TaskOrchestrationExecutor.java Outdated
Comment thread sdk/src/test/java/com/microsoft/durabletask/IntegrationTests.java Outdated

@cgillum cgillum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see this coming along! See my initial feedback below. Let me know if you're still stuck on the test case and I can help debug.

Comment thread sdk/src/main/java/com/microsoft/durabletask/DurableTaskGrpcWorker.java Outdated
OrchestratorService.OrchestratorResponse.Builder responseBuilder = OrchestratorService.OrchestratorResponse.newBuilder();
responseBuilder.setInstanceId(orchestratorRequest.getInstanceId());
responseBuilder.addAllActions(actions);
if(taskOrchestrationExecutor.getCustomStatus() != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about allowing a null custom status.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually a bit surprised this code is duplicated in two places. Does it need to be?

Comment thread sdk/src/test/java/com/microsoft/durabletask/IntegrationTests.java Outdated
Comment thread sdk/src/test/java/com/microsoft/durabletask/IntegrationTests.java Outdated
Comment thread sdk/src/main/java/com/microsoft/durabletask/TaskOrchestrationExecutor.java Outdated

@davidmrdavid davidmrdavid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments as well, mostly just adding to the existing discussion.
So happy to see the quick progress here, good job folks!

Comment thread sdk/src/main/java/com/microsoft/durabletask/DurableTaskGrpcWorker.java Outdated
OrchestratorService.OrchestratorResponse.Builder responseBuilder = OrchestratorService.OrchestratorResponse.newBuilder();
responseBuilder.setInstanceId(orchestratorRequest.getInstanceId());
responseBuilder.addAllActions(actions);
if(taskOrchestrationExecutor.getCustomStatus() != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually a bit surprised this code is duplicated in two places. Does it need to be?

Comment thread sdk/src/test/java/com/microsoft/durabletask/IntegrationTests.java Outdated

@cgillum cgillum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems much cleaner, thanks! A few more small suggestions.

Comment thread sdk/src/main/java/com/microsoft/durabletask/TaskOrchestratorResult.java Outdated
Comment thread sdk/src/main/java/com/microsoft/durabletask/TaskOrchestratorResult.java Outdated
Comment thread sdk/src/test/java/com/microsoft/durabletask/IntegrationTests.java Outdated
Comment thread sdk/src/main/java/com/microsoft/durabletask/TaskOrchestrationExecutor.java Outdated
Comment thread sdk/src/main/java/com/microsoft/durabletask/OrchestrationMetadata.java Outdated
Comment thread sdk/src/main/java/com/microsoft/durabletask/TaskOrchestratorResult.java Outdated
private final String customStatus;

public TaskOrchestratorResult(Collection<OrchestratorService.OrchestratorAction> actions, String customStatus) {
this.actions = ImmutableList.<OrchestratorService.OrchestratorAction>builder().addAll(actions).build();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the 3rd party ImmutableList, let's just use Collections.unmodifiableCollection()

Suggested change
this.actions = ImmutableList.<OrchestratorService.OrchestratorAction>builder().addAll(actions).build();
this.actions = Collections.unmodifiableCollection(actions);

this.customStatus = customStatus;
}

public Collection<OrchestratorService.OrchestratorAction> getActions() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could simply change the return type of this method to Iterable<OrchestratorService.OrchestratorAction> to achieve the same external immutability result.

Suggested change
public Collection<OrchestratorService.OrchestratorAction> getActions() {
public Iterable<OrchestratorService.OrchestratorAction> getActions() {

@cgillum cgillum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shreyas-gopalakrishna
shreyas-gopalakrishna merged commit 5e393a5 into main Apr 11, 2022
@shreyas-gopalakrishna
shreyas-gopalakrishna deleted the shreyasg/custom-status branch April 11, 2022 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom status support

4 participants