|
63 | 63 | import java.util.Set; |
64 | 64 | import java.util.UUID; |
65 | 65 |
|
| 66 | +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; |
66 | 67 | import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; |
67 | 68 | import static jakarta.ws.rs.core.HttpHeaders.AUTHORIZATION; |
68 | | -import static java.util.Collections.emptyMap; |
69 | 69 |
|
70 | 70 | public class Dataplane { |
71 | 71 |
|
72 | | - private final ObjectMapper objectMapper = new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false); |
| 72 | + private final ObjectMapper objectMapper = new ObjectMapper() |
| 73 | + .configure(FAIL_ON_UNKNOWN_PROPERTIES, false) |
| 74 | + .setDefaultPropertyInclusion(NON_NULL); |
73 | 75 | private DataFlowStore dataFlowStore = new InMemoryDataFlowStore(objectMapper); |
74 | 76 | private ControlPlaneStore controlPlaneStore = new InMemoryControlPlaneStore(objectMapper); |
75 | 77 | private String id; |
@@ -274,8 +276,8 @@ public Result<Void> notifyCompleted(String dataFlowId) { |
274 | 276 | return dataFlowStore.findById(dataFlowId) |
275 | 277 | .compose(dataFlow -> { |
276 | 278 | dataFlow.transitionToCompleted(); |
277 | | - |
278 | | - return notifyControlPlane("completed", dataFlow, emptyMap()); |
| 279 | + var message = new DataFlowStatusMessage(dataFlowId, dataFlow.getState().name(), null, null); |
| 280 | + return notifyControlPlane("completed", dataFlow, message); |
279 | 281 | }); |
280 | 282 | } |
281 | 283 |
|
@@ -374,7 +376,7 @@ private Result<Void> notifyControlPlane(String action, DataFlow dataFlow, Object |
374 | 376 | }) |
375 | 377 | .onSuccess(authorizationHeader -> requestBuilder.header(AUTHORIZATION, authorizationHeader)); |
376 | 378 |
|
377 | | - return httpClient.send(requestBuilder.build(), HttpResponse.BodyHandlers.discarding()); |
| 379 | + return httpClient.send(requestBuilder.build(), HttpResponse.BodyHandlers.ofString()); |
378 | 380 | }) |
379 | 381 | .compose(response -> { |
380 | 382 | var successful = response.statusCode() >= 200 && response.statusCode() < 300; |
|
0 commit comments