private void retrieveThing() { final DittoHeaders dittoHeaders = DittoHeaders.newBuilder() .correlationId("thingUpdater-sudoRetrieveThing-" + UUID.randomUUID()) .build(); final SudoRetrieveThing sudoRetrieveThingCmd = SudoRetrieveThing.withOriginalSchemaVersion(thingId, dittoHeaders); final String cmdType = sudoRetrieveThingCmd.getType(); final JsonSchemaVersion implementedSchemaVersion = sudoRetrieveThingCmd.getImplementedSchemaVersion(); final Predicate<JsonField> regularOrSpecialFields = FieldType.regularOrSpecial(); final JsonObject cmdJsonObject = sudoRetrieveThingCmd.toJson(implementedSchemaVersion, regularOrSpecialFields); final Object messageEnvelope = ShardedMessageEnvelope.of(thingId, cmdType, cmdJsonObject, dittoHeaders); // Send a message directly to the Things Shard Region. thingsShardRegion.tell(messageEnvelope, getSelf()); }
/** * Creates a sudo command for retrieving a thing. * * @param thingId the thingId. * @return the created command. */ static SudoRetrieveThing sudoRetrieveThing(final String thingId) { LOGGER.debug("Sending SudoRetrieveThing for Thing with ID <{}>", thingId); final JsonFieldSelector jsonFieldSelector = JsonFieldSelector.newInstance( Thing.JsonFields.ID.getPointer(), Thing.JsonFields.REVISION.getPointer(), Thing.JsonFields.ACL.getPointer(), Thing.JsonFields.POLICY_ID.getPointer()); return SudoRetrieveThing.withOriginalSchemaVersion(thingId, jsonFieldSelector, DittoHeaders.newBuilder().correlationId(getCorrelationId(thingId)).build()); }
private void retrieveThing() { final DittoHeaders dittoHeaders = DittoHeaders.newBuilder() .correlationId("thingUpdater-sudoRetrieveThing-" + UUID.randomUUID()) .build(); final SudoRetrieveThing sudoRetrieveThingCmd = SudoRetrieveThing.withOriginalSchemaVersion(thingId, dittoHeaders); final String cmdType = sudoRetrieveThingCmd.getType(); final JsonSchemaVersion implementedSchemaVersion = sudoRetrieveThingCmd.getImplementedSchemaVersion(); final Predicate<JsonField> regularOrSpecialFields = FieldType.regularOrSpecial(); final JsonObject cmdJsonObject = sudoRetrieveThingCmd.toJson(implementedSchemaVersion, regularOrSpecialFields); final Object messageEnvelope = ShardedMessageEnvelope.of(thingId, cmdType, cmdJsonObject, dittoHeaders); // Send a message directly to the Things Shard Region. thingsShardRegion.tell(messageEnvelope, getSelf()); }