/** * Get the client identifier (combining accountName and clientId).<br> * <b>If the id is null then it is generated</b> * * @param id * @param clientInfo * @return */ public static String getOrDeriveId(StorableId id, ClientInfo clientInfo) { return getOrDeriveId(id, clientInfo.getScopeId(), clientInfo.getClientId()); }
private Map<String, Object> marshalClientInfo(ClientInfo clientInfo) throws ParseException { Map<String, Object> unmarshalledClientInfo = new HashMap<>(); unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_ID, clientInfo.getClientId()); unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_MESSAGE_ID, clientInfo.getFirstMessageId().toString()); unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_TIMESTAMP, KapuaDateUtils.formatDate(clientInfo.getFirstMessageOn())); unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_SCOPE_ID, clientInfo.getScopeId().toStringId()); return unmarshalledClientInfo; }
sort.add(SortField.descending(MessageSchema.MESSAGE_TIMESTAMP)); MessageQuery messageQuery = new MessageQueryImpl(clientInfo.getScopeId()); messageQuery.setAskTotalCount(true); messageQuery.setFetchStyle(StorableFetchStyle.FIELDS); } else if (messageList.isEmpty()) { LOG.warn("Cannot find last timestamp for the specified client id '{}' - account '{}'", clientInfo.getScopeId(), clientInfo.getClientId()); } else { LOG.error("Cannot find last timestamp for the specified client id '{}' - account '{}'. More than one result returned by the query!", clientInfo.getScopeId(), clientInfo.getClientId());
ConfigurationException, ClientException { ArgumentValidator.notNull(clientInfo, "clientInfo"); ArgumentValidator.notNull(clientInfo.getScopeId(), "clientInfo.scopeId"); ArgumentValidator.notNull(clientInfo.getFirstMessageId(), "clientInfo.firstPublishedMessageId"); ArgumentValidator.notNull(clientInfo.getFirstMessageOn(), "clientInfo.firstPublishedMessageTimestamp"); if (!DatastoreCacheManager.getInstance().getClientsCache().get(clientInfo.getClientId())) { ClientInfo storedField = find(clientInfo.getScopeId(), storableId); if (storedField == null) { Metadata metadata = mediator.getMetadata(clientInfo.getScopeId(), clientInfo.getFirstMessageOn().getTime()); String kapuaIndexName = metadata.getRegistryIndexName();