Package com.commercetools.api.client
Interface ConcurrentModificationMiddleware
- All Superinterfaces:
Middleware
Middleware to retry a request upon
ConcurrentModificationException
String projectKey = CommercetoolsTestUtils.getProjectKey();
ProjectApiRoot projectApiRoot = ApiRootBuilder.of()
.defaultClient(ClientCredentials.of()
.withClientId(CommercetoolsTestUtils.getClientId())
.withClientSecret(CommercetoolsTestUtils.getClientSecret())
.build(),
ServiceRegion.GCP_EUROPE_WEST1)
.addConcurrentModificationMiddleware(3)
.build(projectKey);
CartsFixtures.withUpdateableCart(cart -> {
final ApiHttpResponse<Cart> deCart = projectApiRoot.carts()
.withId(cart.getId())
.post(CartUpdateBuilder.of()
.version(cart.getVersion())
.actions(CartSetCountryActionBuilder.of().country("DE").build())
.build())
.executeBlocking();
final Cart modCart = projectApiRoot.carts()
.withId(cart.getId())
.post(CartUpdateBuilder.of()
.version(cart.getVersion())
.actions(CartSetCountryActionBuilder.of().country("DE").build())
.build())
.executeBlocking()
.getBody();
Assertions.assertThat(modCart.getId()).isEqualTo(cart.getId());
Assertions.assertThat(modCart.getVersion()).isGreaterThan(cart.getVersion());
Assertions.assertThat(modCart.getVersion()).isGreaterThan(deCart.getBody().getVersion());
return modCart;
});
See the test code.
-
Method Summary
Static MethodsMethods inherited from interface io.vrap.rmf.base.client.http.Middleware
invoke
-
Method Details
-
of
-
of
-
of
-