public FlowId flow(String program) { return new FlowId(this, program); }
private FlowId deserializeFlowId(JsonObject id) { ApplicationId applicationId = deserializeApplicationId(id); return new FlowId(applicationId, id.get("flow").getAsString()); }
private FlowId deserializeFlowId(JsonObject id) { ProgramId flow = deserializeProgramId(id); return new FlowId(flow.getParent(), id.get("flow").getAsString()); }
@Override public void dropAll(StreamId streamId, String namespace, Iterable<Long> groupIds) throws IOException { // A bit hacky to assume namespace is formed by appId.flowId. See AbstractDataFabricFacade // String namespace = String.format("%s.%s", // programId.getApplicationId(), // programId.getId()); String invalidNamespaceError = String.format("Namespace string %s must be of the form <app>.<flow>", namespace); Iterator<String> namespaceParts = Splitter.on('.').split(namespace).iterator(); Preconditions.checkArgument(namespaceParts.hasNext(), invalidNamespaceError); String appId = namespaceParts.next(); Preconditions.checkArgument(namespaceParts.hasNext(), invalidNamespaceError); String flowId = namespaceParts.next(); queueService.truncateAllWithPrefix(QueueName.prefixForFlow(new FlowId(streamId.getNamespace(), appId, flowId))); } }
/** * Deletes queues. */ @DELETE @Path("/apps/{app-id}/flows/{flow-id}/queues") public void deleteFlowQueues(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("flow-id") String flowId) throws Exception { FlowId flow = new FlowId(namespaceId, appId, flowId); try { ProgramStatus status = lifecycleService.getProgramStatus(flow); if (ProgramStatus.STOPPED != status) { responder.sendString(HttpResponseStatus.FORBIDDEN, "Flow is running, please stop it first."); } else { queueAdmin.dropAllForFlow(flow); FlowUtils.deleteFlowPendingMetrics(metricStore, namespaceId, appId, flowId); responder.sendStatus(HttpResponseStatus.OK); } } catch (SecurityException e) { responder.sendStatus(HttpResponseStatus.UNAUTHORIZED); } }
public TableId getDataTableId(QueueName queueName, QueueConstants.QueueType queueType) throws IOException { if (!queueName.isQueue()) { throw new IllegalArgumentException("'" + queueName + "' is not a valid name for a queue."); } return getDataTableId(new FlowId(queueName.getFirstComponent(), queueName.getSecondComponent(), queueName.getThirdComponent()), queueType); }
public String getActualTableName(QueueName queueName) { return getTableNameForFlow(new FlowId(queueName.getFirstComponent(), queueName.getSecondComponent(), queueName.getThirdComponent())); }