Skip to content

Updating state management example to include etag mismatch exception handling#458

Merged
artursouza merged 3 commits intodapr:masterfrom
kachawla:master
Jan 27, 2021
Merged

Updating state management example to include etag mismatch exception handling#458
artursouza merged 3 commits intodapr:masterfrom
kachawla:master

Conversation

@kachawla
Copy link
Copy Markdown
Contributor

@kachawla kachawla commented Jan 26, 2021

Description

Updating state management example to include etag mismatch exception scenario. Dapr runtime grpc exception handling was recently updated to return aborted error code on etage mismatch for mutations, the example is updated to reflect that the runtime updates will be propagated through the java sdk.
ABORTED: failed deleting state with key myKey: possible etag mismatch. error from state store: ERR Error running script (call to f_9b5da7354cb61e2ca9faff50f6c43b81c73c0b94): @user_script:1: user_script:1: failed to delete Pixiemango-King||myKey

There were no updates to HTTP in runtime https://github.com/dapr/dapr/blob/3481920cb533b46a9073e206aa215deb2a06e71e/pkg/http/api.go#L549, but I verified that that the error sent by Dapr runtime is passed through for http as well.
Caused by: io.dapr.exceptions.DaprException: ERR_STATE_DELETE: failed deleting state with key myKey: possible etag mismatch. error from state store: ERR Error running script (call to f_9b5da7354cb61e2ca9faff50f6c43b81c73c0b94): @user_script:1: user_script:1: failed to delete Mousespice-Roarer||myKey

The updated state.png file is copied below for review.

Issue reference

Please reference the issue this PR will close: #437

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

state

…scenario. Dapr runtime grpc exception handling was recently updated to return aborted error code on etage mismatch for mutations, the example is updated to reflect that the runtime updates will be propagated through the java sdk.
mukundansundar
mukundansundar previously approved these changes Jan 27, 2021
// delete state API
Mono<Void> mono = client.deleteState(STATE_STORE_NAME, FIRST_KEY_NAME);
try {
Mono<Void> mono = client.deleteState(STATE_STORE_NAME, FIRST_KEY_NAME, "100", null);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can do a block right in the end of this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch, updated

Comment thread examples/src/main/java/io/dapr/examples/state/README.md Outdated
Comment thread examples/src/main/java/io/dapr/examples/state/StateClient.java Outdated
Comment thread examples/src/main/java/io/dapr/examples/state/StateClient.java Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 27, 2021

Codecov Report

Merging #458 (684ce8a) into master (c5b4cbd) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #458   +/-   ##
=========================================
  Coverage     82.92%   82.92%           
  Complexity      931      931           
=========================================
  Files            79       79           
  Lines          2717     2717           
  Branches        269      269           
=========================================
  Hits           2253     2253           
  Misses          331      331           
  Partials        133      133           
Impacted Files Coverage Δ Complexity Δ
sdk/src/main/java/io/dapr/client/domain/State.java 74.39% <ø> (ø) 20.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5b4cbd...684ce8a. Read the comment docs.

@artursouza artursouza merged commit efee056 into dapr:master Jan 27, 2021
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.

etag error code changes in dapr runtime need a change in the sdk

3 participants