private void registerTarget(final Message message, final String virtualHost) {
        final String thingId = getStringHeaderKey(message, MessageHeaderKey.THING_ID, "ThingId is null");
        final String replyTo = message.getMessageProperties().getReplyTo();

        if (StringUtils.isEmpty(replyTo)) {
            logAndThrowMessageError(message, "No ReplyTo was set for the createThing message.");
        }

        final URI amqpUri = IpUtil.createAmqpUri(virtualHost, replyTo);
        final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist(thingId, amqpUri);
        LOG.debug("Target {} reported online state.", thingId);

        lookIfUpdateAvailable(target);
    }
private void registerTarget ( final Message message , final String virtualHost ) { final String thingId = getStringHeaderKey ( message , MessageHeaderKey . THING_ID , "ThingId is null" ) ; final String replyTo = message . getMessageProperties ( ) . getReplyTo ( ) ; if ( StringUtils . isEmpty ( replyTo ) ) { logAndThrowMessageError ( message , "No ReplyTo was set for the createThing message." ) ; } final URI amqpUri = IpUtil . createAmqpUri ( virtualHost , replyTo ) ; final 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.

@param targetID
the ID of the target/thing
@param ip
the ip of the target/thing