Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions examples/src/main/java/io/zenoh/ZGet.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,20 @@ public Integer call() throws ZError, InterruptedException {
Config config = loadConfig(emptyArgs, configFile, connect, listen, noMulticastScouting, mode);
Selector selector = Selector.tryFrom(this.selectorOpt);

ZBytes payload = Optional.ofNullable(this.payload)
.map(ZBytes::from)
.orElse(null);
ZBytes attachment = Optional.ofNullable(this.attachment)
.map(ZBytes::from)
.orElse(null);

// Load GET options
GetOptions options = new GetOptions();
options.setPayload(ZBytes.from(this.payload));

options.setPayload(payload);
options.setTarget(QueryTarget.valueOf(this.target));
options.setTimeout(Duration.ofMillis(this.timeout));
options.setAttachment(ZBytes.from(this.attachment));
options.setAttachment(attachment);


// A GET query can be performed in different ways, by default (using a blocking queue), using a callback
Expand Down Expand Up @@ -146,7 +154,8 @@ private void handleReply(Reply reply) {
@CommandLine.Option(
names = {"-t", "--target"},
description = "The target queryables of the query. Default: BEST_MATCHING. " +
"[possible values: BEST_MATCHING, ALL, ALL_COMPLETE]"
"[possible values: BEST_MATCHING, ALL, ALL_COMPLETE]",
defaultValue = "BEST_MATCHING"
)
private String target;

Expand Down
Loading