Skip to content

Commit ae05a59

Browse files
wirew0rmRalphSteinhagen
authored andcommitted
DataSourcePublisher: allow to pass binary data
Allows to provide pre-serialised binary data to Set commands the same way as to receive non-deserialized data via the BinaryData special domain object. This is needed for use-cases which provide run-time dynamic set and get access e.g. via a map interface. Signed-off-by: Alexander Krimm <[email protected]>
1 parent d6cf8d9 commit ae05a59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

client/src/main/java/io/opencmw/client/DataSourcePublisher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ private <R, C> void request(final String requestId, final Command requestType, f
526526
msg.add(endpoint.toString());
527527
if (requestBody == null) {
528528
msg.add(EMPTY_ZFRAME);
529+
} else if (requestBody instanceof BinaryData binaryData) {
530+
msg.add(Arrays.copyOfRange(binaryData.data, 0, binaryData.dataSize > 0 ? binaryData.dataSize : binaryData.data.length));
529531
} else {
530532
final Class<? extends IoSerialiser> matchingSerialiser = DataSource.getFactory(endpoint).getMatchingSerialiserType(endpoint);
531533
final IoClassSerialiser serialiser = getSerialiser(); // lazily initialize IoClassSerialiser

0 commit comments

Comments
 (0)