private fun registerTarget(message: Message, virtualHost: String) {val thingId: String = getStringHeaderKey(message, MessageHeaderKey.THING_ID, "ThingId is null") val replyTo: String = message.getMessageProperties().getReplyTo() if (com.sun.tools.javac.util.StringUtils.isEmpty(replyTo)) { logAndThrowMessageError(message, "No ReplyTo was set for the createThing Event.") } val amqpUri: URI = IpUtil.createAmqpUri(virtualHost, replyTo) val target: Target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(thingId, amqpUri) LOG.debug("Target {} reported online state.", thingId) lookIfUpdateAvailable(target) }
Method to create a new target or to find the target if it already exists .