Search in sources :

Example 36 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project qpid-broker-j by apache.

the class AbstractSystemConfig method makeActive.

protected ListenableFuture<Void> makeActive() {
    final EventLogger eventLogger = _eventLogger;
    final EventLogger startupLogger = initiateStartupLogging();
    try {
        final Container<?> container = initiateStoreAndRecovery();
        container.setEventLogger(startupLogger);
        final SettableFuture<Void> returnVal = SettableFuture.create();
        addFutureCallback(container.openAsync(), new FutureCallback() {

            @Override
            public void onSuccess(final Object result) {
                State state = container.getState();
                if (state == State.ACTIVE) {
                    startupLogger.message(BrokerMessages.READY());
                    container.setEventLogger(eventLogger);
                    returnVal.set(null);
                } else {
                    returnVal.setException(new ServerScopedRuntimeException("Broker failed reach ACTIVE state (state is " + state + ")"));
                }
            }

            @Override
            public void onFailure(final Throwable t) {
                returnVal.setException(t);
            }
        }, getTaskExecutor());
        return returnVal;
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : EventLogger(org.apache.qpid.server.logging.EventLogger) IOException(java.io.IOException) FutureCallback(com.google.common.util.concurrent.FutureCallback) ServerScopedRuntimeException(org.apache.qpid.server.util.ServerScopedRuntimeException)

Example 37 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class TelemetryController method deleteAttributes.

private DeferredResult<ResponseEntity> deleteAttributes(EntityId entityIdSrc, String scope, String keysStr) throws ThingsboardException {
    List<String> keys = toKeysList(keysStr);
    if (keys.isEmpty()) {
        return getImmediateDeferredResult("Empty keys: " + keysStr, HttpStatus.BAD_REQUEST);
    }
    SecurityUser user = getCurrentUser();
    if (DataConstants.SERVER_SCOPE.equals(scope) || DataConstants.SHARED_SCOPE.equals(scope) || DataConstants.CLIENT_SCOPE.equals(scope)) {
        return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.WRITE_ATTRIBUTES, entityIdSrc, (result, tenantId, entityId) -> {
            tsSubService.deleteAndNotify(tenantId, entityId, scope, keys, new FutureCallback<Void>() {

                @Override
                public void onSuccess(@Nullable Void tmp) {
                    logAttributesDeleted(user, entityId, scope, keys, null);
                    if (entityIdSrc.getEntityType().equals(EntityType.DEVICE)) {
                        DeviceId deviceId = new DeviceId(entityId.getId());
                        Set<AttributeKey> keysToNotify = new HashSet<>();
                        keys.forEach(key -> keysToNotify.add(new AttributeKey(scope, key)));
                        tbClusterService.pushMsgToCore(DeviceAttributesEventNotificationMsg.onDelete(user.getTenantId(), deviceId, keysToNotify), null);
                    }
                    result.setResult(new ResponseEntity<>(HttpStatus.OK));
                }

                @Override
                public void onFailure(Throwable t) {
                    logAttributesDeleted(user, entityId, scope, keys, t);
                    result.setResult(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
                }
            });
        });
    } else {
        return getImmediateDeferredResult("Invalid attribute scope: " + scope, HttpStatus.BAD_REQUEST);
    }
}
Also used : TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) RequestParam(org.springframework.web.bind.annotation.RequestParam) Arrays(java.util.Arrays) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) BaseDeleteTsKvQuery(org.thingsboard.server.common.data.kv.BaseDeleteTsKvQuery) TsData(org.thingsboard.server.service.telemetry.TsData) ENTITY_TYPE_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ENTITY_TYPE_PARAM_DESCRIPTION) SORT_ORDER_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES) ApiParam(io.swagger.annotations.ApiParam) Autowired(org.springframework.beans.factory.annotation.Autowired) STRICT_DATA_TYPES_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.STRICT_DATA_TYPES_DESCRIPTION) TenantId(org.thingsboard.server.common.data.id.TenantId) Map(java.util.Map) SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED) SAVE_ATTIRIBUTES_STATUS_OK(org.thingsboard.server.controller.ControllerConstants.SAVE_ATTIRIBUTES_STATUS_OK) JsonConverter(org.thingsboard.server.common.transport.adaptor.JsonConverter) INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION) JsonNode(com.fasterxml.jackson.databind.JsonNode) ATTRIBUTES_KEYS_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_KEYS_DESCRIPTION) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) Set(java.util.Set) RestController(org.springframework.web.bind.annotation.RestController) DeleteTsKvQuery(org.thingsboard.server.common.data.kv.DeleteTsKvQuery) Executors(java.util.concurrent.Executors) TsKvEntry(org.thingsboard.server.common.data.kv.TsKvEntry) Slf4j(lombok.extern.slf4j.Slf4j) Operation(org.thingsboard.server.service.security.permission.Operation) BooleanDataEntry(org.thingsboard.server.common.data.kv.BooleanDataEntry) DeferredResult(org.springframework.web.context.request.async.DeferredResult) TELEMETRY_KEYS_BASE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_KEYS_BASE_DESCRIPTION) JsonParser(com.google.gson.JsonParser) DEVICE_ID(org.thingsboard.server.controller.ControllerConstants.DEVICE_ID) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) LinkedHashMap(java.util.LinkedHashMap) EntityIdFactory(org.thingsboard.server.common.data.id.EntityIdFactory) DEVICE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_ID_PARAM_DESCRIPTION) DataType(org.thingsboard.server.common.data.kv.DataType) SAVE_ATTRIBUTES_REQUEST_PAYLOAD(org.thingsboard.server.controller.ControllerConstants.SAVE_ATTRIBUTES_REQUEST_PAYLOAD) Nullable(javax.annotation.Nullable) DataConstants(org.thingsboard.server.common.data.DataConstants) ATTRIBUTES_JSON_REQUEST_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_JSON_REQUEST_DESCRIPTION) ConstraintValidator(org.thingsboard.server.dao.service.ConstraintValidator) ATTRIBUTES_SCOPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_SCOPE_DESCRIPTION) BaseAttributeKvEntry(org.thingsboard.server.common.data.kv.BaseAttributeKvEntry) FutureCallback(com.google.common.util.concurrent.FutureCallback) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED) ApiResponse(io.swagger.annotations.ApiResponse) MARKDOWN_CODE_BLOCK_START(org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_START) ReadTsKvQuery(org.thingsboard.server.common.data.kv.ReadTsKvQuery) ENTITY_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ENTITY_ID_PARAM_DESCRIPTION) StringDataEntry(org.thingsboard.server.common.data.kv.StringDataEntry) PathVariable(org.springframework.web.bind.annotation.PathVariable) SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR) SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR) DefaultTenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration) BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) ApiOperation(io.swagger.annotations.ApiOperation) AttributeKvEntry(org.thingsboard.server.common.data.kv.AttributeKvEntry) PreDestroy(javax.annotation.PreDestroy) INVALID_STRUCTURE_OF_THE_REQUEST(org.thingsboard.server.controller.ControllerConstants.INVALID_STRUCTURE_OF_THE_REQUEST) EntityType(org.thingsboard.server.common.data.EntityType) TS_STRICT_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.TS_STRICT_DATA_EXAMPLE) DeviceAttributesEventNotificationMsg(org.thingsboard.rule.engine.api.msg.DeviceAttributesEventNotificationMsg) BaseReadTsKvQuery(org.thingsboard.server.common.data.kv.BaseReadTsKvQuery) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Function(com.google.common.base.Function) MARKDOWN_CODE_BLOCK_END(org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_END) AttributeData(org.thingsboard.server.service.telemetry.AttributeData) MediaType(org.springframework.http.MediaType) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) TimeseriesService(org.thingsboard.server.dao.timeseries.TimeseriesService) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) UncheckedApiException(org.thingsboard.server.service.telemetry.exception.UncheckedApiException) LATEST_TS_NON_STRICT_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.LATEST_TS_NON_STRICT_DATA_EXAMPLE) Collectors(java.util.stream.Collectors) TELEMETRY_KEYS_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_KEYS_DESCRIPTION) TELEMETRY_JSON_REQUEST_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_JSON_REQUEST_DESCRIPTION) List(java.util.List) KvEntry(org.thingsboard.server.common.data.kv.KvEntry) PostConstruct(javax.annotation.PostConstruct) TELEMETRY_SCOPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_SCOPE_DESCRIPTION) SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST(org.thingsboard.server.controller.ControllerConstants.SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST) SORT_ORDER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_DESCRIPTION) LongDataEntry(org.thingsboard.server.common.data.kv.LongDataEntry) JsonParseException(com.google.gson.JsonParseException) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) ATTRIBUTE_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTE_DATA_EXAMPLE) SAVE_TIMESERIES_REQUEST_PAYLOAD(org.thingsboard.server.controller.ControllerConstants.SAVE_TIMESERIES_REQUEST_PAYLOAD) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) SAVE_ENTITY_ATTRIBUTES_STATUS_OK(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_ATTRIBUTES_STATUS_OK) JacksonUtil(org.thingsboard.common.util.JacksonUtil) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ApiResponses(io.swagger.annotations.ApiResponses) JsonElement(com.google.gson.JsonElement) HashSet(java.util.HashSet) TenantProfile(org.thingsboard.server.common.data.TenantProfile) ActionType(org.thingsboard.server.common.data.audit.ActionType) TbCoreComponent(org.thingsboard.server.queue.util.TbCoreComponent) EntityId(org.thingsboard.server.common.data.id.EntityId) UUIDBased(org.thingsboard.server.common.data.id.UUIDBased) DoubleDataEntry(org.thingsboard.server.common.data.kv.DoubleDataEntry) ExecutorService(java.util.concurrent.ExecutorService) AttributeKey(org.thingsboard.server.common.data.kv.AttributeKey) ATTRIBUTES_SCOPE_ALLOWED_VALUES(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_SCOPE_ALLOWED_VALUES) AccessValidator(org.thingsboard.server.service.security.AccessValidator) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) Aggregation(org.thingsboard.server.common.data.kv.Aggregation) LATEST_TS_STRICT_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.LATEST_TS_STRICT_DATA_EXAMPLE) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) SAVE_ENTITY_TIMESERIES_STATUS_OK(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_TIMESERIES_STATUS_OK) InvalidParametersException(org.thingsboard.server.service.telemetry.exception.InvalidParametersException) TimeUnit(java.util.concurrent.TimeUnit) JsonDataEntry(org.thingsboard.server.common.data.kv.JsonDataEntry) ResponseEntity(org.springframework.http.ResponseEntity) ENTITY_ATTRIBUTE_SCOPES(org.thingsboard.server.controller.ControllerConstants.ENTITY_ATTRIBUTE_SCOPES) StringUtils(org.springframework.util.StringUtils) Set(java.util.Set) HashSet(java.util.HashSet) DeviceId(org.thingsboard.server.common.data.id.DeviceId) AttributeKey(org.thingsboard.server.common.data.kv.AttributeKey) ResponseEntity(org.springframework.http.ResponseEntity) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser)

Example 38 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class EdgeGrpcSession method processEdgeEvents.

ListenableFuture<Void> processEdgeEvents() throws Exception {
    SettableFuture<Void> result = SettableFuture.create();
    log.trace("[{}] starting processing edge events", this.sessionId);
    if (isConnected() && isSyncCompleted()) {
        Long queueStartTs = getQueueStartTs().get();
        GeneralEdgeEventFetcher fetcher = new GeneralEdgeEventFetcher(queueStartTs, ctx.getEdgeEventService());
        ListenableFuture<UUID> ifOffsetFuture = startProcessingEdgeEvents(fetcher);
        Futures.addCallback(ifOffsetFuture, new FutureCallback<>() {

            @Override
            public void onSuccess(@Nullable UUID ifOffset) {
                if (ifOffset != null) {
                    Long newStartTs = Uuids.unixTimestamp(ifOffset);
                    ListenableFuture<List<Void>> updateFuture = updateQueueStartTs(newStartTs);
                    Futures.addCallback(updateFuture, new FutureCallback<>() {

                        @Override
                        public void onSuccess(@Nullable List<Void> list) {
                            log.debug("[{}] queue offset was updated [{}][{}]", sessionId, ifOffset, newStartTs);
                            result.set(null);
                        }

                        @Override
                        public void onFailure(Throwable t) {
                            log.error("[{}] Failed to update queue offset [{}]", sessionId, ifOffset, t);
                            result.setException(t);
                        }
                    }, ctx.getGrpcCallbackExecutorService());
                } else {
                    log.trace("[{}] ifOffset is null. Skipping iteration without db update", sessionId);
                    result.set(null);
                }
            }

            @Override
            public void onFailure(Throwable t) {
                log.error("[{}] Failed to process events", sessionId, t);
                result.setException(t);
            }
        }, ctx.getGrpcCallbackExecutorService());
    } else {
        log.trace("[{}] edge is not connected or sync is not completed. Skipping iteration", sessionId);
        result.set(null);
    }
    return result;
}
Also used : ListenableFuture(com.google.common.util.concurrent.ListenableFuture) List(java.util.List) ArrayList(java.util.ArrayList) UUID(java.util.UUID) GeneralEdgeEventFetcher(org.thingsboard.server.service.edge.rpc.fetch.GeneralEdgeEventFetcher) FutureCallback(com.google.common.util.concurrent.FutureCallback) Nullable(org.checkerframework.checker.nullness.qual.Nullable)

Example 39 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class CassandraBaseTimeseriesDao method findAllAsyncSequentiallyWithLimit.

private void findAllAsyncSequentiallyWithLimit(TenantId tenantId, final TsKvQueryCursor cursor, final SimpleListenableFuture<List<TsKvEntry>> resultFuture) {
    if (cursor.isFull() || !cursor.hasNextPartition()) {
        resultFuture.set(cursor.getData());
    } else {
        PreparedStatement proto = getFetchStmt(Aggregation.NONE, cursor.getOrderBy());
        BoundStatementBuilder stmtBuilder = new BoundStatementBuilder(proto.bind());
        stmtBuilder.setString(0, cursor.getEntityType());
        stmtBuilder.setUuid(1, cursor.getEntityId());
        stmtBuilder.setString(2, cursor.getKey());
        stmtBuilder.setLong(3, cursor.getNextPartition());
        stmtBuilder.setLong(4, cursor.getStartTs());
        stmtBuilder.setLong(5, cursor.getEndTs());
        stmtBuilder.setInt(6, cursor.getCurrentLimit());
        BoundStatement stmt = stmtBuilder.build();
        Futures.addCallback(executeAsyncRead(tenantId, stmt), new FutureCallback<TbResultSet>() {

            @Override
            public void onSuccess(@Nullable TbResultSet result) {
                if (result == null) {
                    cursor.addData(convertResultToTsKvEntryList(Collections.emptyList()));
                    findAllAsyncSequentiallyWithLimit(tenantId, cursor, resultFuture);
                } else {
                    Futures.addCallback(result.allRows(readResultsProcessingExecutor), new FutureCallback<List<Row>>() {

                        @Override
                        public void onSuccess(@Nullable List<Row> result) {
                            cursor.addData(convertResultToTsKvEntryList(result == null ? Collections.emptyList() : result));
                            findAllAsyncSequentiallyWithLimit(tenantId, cursor, resultFuture);
                        }

                        @Override
                        public void onFailure(Throwable t) {
                            log.error("[{}][{}] Failed to fetch data for query {}-{}", stmt, t);
                        }
                    }, readResultsProcessingExecutor);
                }
            }

            @Override
            public void onFailure(Throwable t) {
                log.error("[{}][{}] Failed to fetch data for query {}-{}", stmt, t);
            }
        }, readResultsProcessingExecutor);
    }
}
Also used : TbResultSet(org.thingsboard.server.dao.nosql.TbResultSet) BoundStatementBuilder(com.datastax.oss.driver.api.core.cql.BoundStatementBuilder) PreparedStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement) List(java.util.List) ArrayList(java.util.ArrayList) Row(com.datastax.oss.driver.api.core.cql.Row) BoundStatement(com.datastax.oss.driver.api.core.cql.BoundStatement) FutureCallback(com.google.common.util.concurrent.FutureCallback) Nullable(javax.annotation.Nullable)

Example 40 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class TbCopyAttributesToEntityViewNode method onMsg.

@Override
public void onMsg(TbContext ctx, TbMsg msg) {
    if (DataConstants.ATTRIBUTES_UPDATED.equals(msg.getType()) || DataConstants.ATTRIBUTES_DELETED.equals(msg.getType()) || DataConstants.ACTIVITY_EVENT.equals(msg.getType()) || SessionMsgType.POST_ATTRIBUTES_REQUEST.name().equals(msg.getType())) {
        if (!msg.getMetaData().getData().isEmpty()) {
            long now = System.currentTimeMillis();
            String scope = msg.getType().equals(SessionMsgType.POST_ATTRIBUTES_REQUEST.name()) ? DataConstants.CLIENT_SCOPE : msg.getMetaData().getValue(DataConstants.SCOPE);
            ListenableFuture<List<EntityView>> entityViewsFuture = ctx.getEntityViewService().findEntityViewsByTenantIdAndEntityIdAsync(ctx.getTenantId(), msg.getOriginator());
            DonAsynchron.withCallback(entityViewsFuture, entityViews -> {
                for (EntityView entityView : entityViews) {
                    long startTime = entityView.getStartTimeMs();
                    long endTime = entityView.getEndTimeMs();
                    if ((endTime != 0 && endTime > now && startTime < now) || (endTime == 0 && startTime < now)) {
                        if (DataConstants.ATTRIBUTES_UPDATED.equals(msg.getType()) || DataConstants.ACTIVITY_EVENT.equals(msg.getType()) || SessionMsgType.POST_ATTRIBUTES_REQUEST.name().equals(msg.getType())) {
                            Set<AttributeKvEntry> attributes = JsonConverter.convertToAttributes(new JsonParser().parse(msg.getData()));
                            List<AttributeKvEntry> filteredAttributes = attributes.stream().filter(attr -> attributeContainsInEntityView(scope, attr.getKey(), entityView)).collect(Collectors.toList());
                            ctx.getTelemetryService().saveAndNotify(ctx.getTenantId(), entityView.getId(), scope, filteredAttributes, new FutureCallback<Void>() {

                                @Override
                                public void onSuccess(@Nullable Void result) {
                                    transformAndTellNext(ctx, msg, entityView);
                                }

                                @Override
                                public void onFailure(Throwable t) {
                                    ctx.tellFailure(msg, t);
                                }
                            });
                        } else if (DataConstants.ATTRIBUTES_DELETED.equals(msg.getType())) {
                            List<String> attributes = new ArrayList<>();
                            for (JsonElement element : new JsonParser().parse(msg.getData()).getAsJsonObject().get("attributes").getAsJsonArray()) {
                                if (element.isJsonPrimitive()) {
                                    JsonPrimitive value = element.getAsJsonPrimitive();
                                    if (value.isString()) {
                                        attributes.add(value.getAsString());
                                    }
                                }
                            }
                            List<String> filteredAttributes = attributes.stream().filter(attr -> attributeContainsInEntityView(scope, attr, entityView)).collect(Collectors.toList());
                            if (!filteredAttributes.isEmpty()) {
                                ctx.getAttributesService().removeAll(ctx.getTenantId(), entityView.getId(), scope, filteredAttributes);
                                transformAndTellNext(ctx, msg, entityView);
                            }
                        }
                    }
                }
                ctx.ack(msg);
            }, t -> ctx.tellFailure(msg, t));
        } else {
            ctx.tellFailure(msg, new IllegalArgumentException("Message metadata is empty"));
        }
    } else {
        ctx.tellFailure(msg, new IllegalArgumentException("Unsupported msg type [" + msg.getType() + "]"));
    }
}
Also used : ComponentType(org.thingsboard.server.common.data.plugin.ComponentType) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) TbMsg(org.thingsboard.server.common.msg.TbMsg) DonAsynchron(org.thingsboard.common.util.DonAsynchron) JsonParser(com.google.gson.JsonParser) TbContext(org.thingsboard.rule.engine.api.TbContext) SUCCESS(org.thingsboard.rule.engine.api.TbRelationTypes.SUCCESS) ArrayList(java.util.ArrayList) JsonElement(com.google.gson.JsonElement) AttributeKvEntry(org.thingsboard.server.common.data.kv.AttributeKvEntry) TbNodeException(org.thingsboard.rule.engine.api.TbNodeException) SessionMsgType(org.thingsboard.server.common.msg.session.SessionMsgType) EmptyNodeConfiguration(org.thingsboard.rule.engine.api.EmptyNodeConfiguration) JsonConverter(org.thingsboard.server.common.transport.adaptor.JsonConverter) JsonPrimitive(com.google.gson.JsonPrimitive) Nullable(javax.annotation.Nullable) DataConstants(org.thingsboard.server.common.data.DataConstants) Set(java.util.Set) Collectors(java.util.stream.Collectors) FutureCallback(com.google.common.util.concurrent.FutureCallback) RuleNode(org.thingsboard.rule.engine.api.RuleNode) EntityView(org.thingsboard.server.common.data.EntityView) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) TbNodeConfiguration(org.thingsboard.rule.engine.api.TbNodeConfiguration) TbNodeUtils(org.thingsboard.rule.engine.api.util.TbNodeUtils) TbNode(org.thingsboard.rule.engine.api.TbNode) AttributeKvEntry(org.thingsboard.server.common.data.kv.AttributeKvEntry) EntityView(org.thingsboard.server.common.data.EntityView) JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) ArrayList(java.util.ArrayList) List(java.util.List) JsonParser(com.google.gson.JsonParser)

Aggregations

FutureCallback (com.google.common.util.concurrent.FutureCallback)98 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)56 List (java.util.List)48 Futures (com.google.common.util.concurrent.Futures)43 ArrayList (java.util.ArrayList)41 Nullable (javax.annotation.Nullable)38 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)26 Map (java.util.Map)25 Set (java.util.Set)25 TimeUnit (java.util.concurrent.TimeUnit)24 IOException (java.io.IOException)23 Collectors (java.util.stream.Collectors)23 PostConstruct (javax.annotation.PostConstruct)23 ExecutorService (java.util.concurrent.ExecutorService)22 Function (com.google.common.base.Function)21 Collections (java.util.Collections)21 TenantId (org.thingsboard.server.common.data.id.TenantId)21 PreDestroy (javax.annotation.PreDestroy)20 Logger (org.slf4j.Logger)19 LoggerFactory (org.slf4j.LoggerFactory)19