Skip to content

Empty responses should not result in a null future in the client #23075

@remcowesterhoud

Description

@remcowesterhoud

Description

Making Rest call using the Java Client results in a ZeebeFuture containing the specific response for this request. This is the same way we worked with gRPC.

This becomes interesting when the Rest API returns an empty response (204). The body returned by the request will be null. As a result we complete the future, with a null value in it.

⚠️ This is a breaking change from gRPC, where we would complete the future with an empty response object

This is dirty from a user perspective. If I call a method using the client it states I will receive a ZeebeFuture with a response object. As a user I would expect that joining this future on successful request would yield me this response object. Now it results in null.
If the request wasn't successful it should yield an exception, which is what already happens now 👍

Proposal

We should always add a response object to the ZeebeFuture in the java client.

I think there's 2 options:

  1. We do something clever in the java client to always instantiate a response object if the response body is null.
  2. We don't return No Content (204) responses from the Rest API at all. In cases where we don't need to specify anything in the resposne it could be an empty object.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions