Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A7C33200D50 for ; Mon, 4 Dec 2017 17:26:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A62A2160BF9; Mon, 4 Dec 2017 16:26:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C50D3160BF3 for ; Mon, 4 Dec 2017 17:26:07 +0100 (CET) Received: (qmail 42108 invoked by uid 500); 4 Dec 2017 16:26:06 -0000 Mailing-List: contact issues-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list issues@geode.apache.org Received: (qmail 42099 invoked by uid 99); 4 Dec 2017 16:26:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Dec 2017 16:26:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2846BC5525 for ; Mon, 4 Dec 2017 16:26:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id rGYzQIxbmGvh for ; Mon, 4 Dec 2017 16:26:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 3E1235FB52 for ; Mon, 4 Dec 2017 16:26:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8CD2EE0AA3 for ; Mon, 4 Dec 2017 16:26:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 92D51255C2 for ; Mon, 4 Dec 2017 16:26:01 +0000 (UTC) Date: Mon, 4 Dec 2017 16:26:01 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@geode.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 04 Dec 2017 16:26:08 -0000 [ https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277037#comment-16277037 ] ASF GitHub Bot commented on GEODE-2665: --------------------------------------- jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh command to delete async event queues URL: https://github.com/apache/geode/pull/1116#discussion_r154698337 ########## File path: geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.management.internal.cli.commands; + +import static org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS; +import static org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP; + +import java.util.List; +import java.util.Set; + +import org.springframework.shell.core.annotation.CliCommand; +import org.springframework.shell.core.annotation.CliOption; + +import org.apache.geode.cache.execute.Function; +import org.apache.geode.cache.execute.ResultCollector; +import org.apache.geode.distributed.DistributedMember; +import org.apache.geode.internal.logging.LogService; +import org.apache.geode.management.cli.ConverterHint; +import org.apache.geode.management.cli.Result; +import org.apache.geode.management.internal.cli.functions.CliFunctionResult; +import org.apache.geode.management.internal.cli.functions.DestroyAsyncEventQueueFunction; +import org.apache.geode.management.internal.cli.functions.DestroyAsyncEventQueueFunctionArgs; +import org.apache.geode.management.internal.cli.i18n.CliStrings; +import org.apache.geode.management.internal.cli.result.ResultBuilder; +import org.apache.geode.management.internal.cli.result.TabularResultData; +import org.apache.geode.management.internal.security.ResourceOperation; +import org.apache.geode.security.ResourcePermission; + +public class DestroyAsyncEventQueueCommand implements GfshCommand { + public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy async-event-queue"; + public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an Async Event Queue"; + public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id"; + public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP = + "ID of the queue to be destroyed."; + public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP = + "Group(s) of members on which to destroy the async event queue."; + + public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND = + "Async event queue \"%s\" not found"; + public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED = + "Async event queue \"%s\" destroyed"; + + @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = DESTROY_ASYNC_EVENT_QUEUE__HELP) + @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER, + operation = ResourcePermission.Operation.MANAGE) + public Result destroyAsyncEventQueue( + @CliOption(key = DESTROY_ASYNC_EVENT_QUEUE__ID, mandatory = true, + help = DESTROY_ASYNC_EVENT_QUEUE__ID__HELP) String aeqId, + @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS}, + optionContext = ConverterHint.MEMBERGROUP, + help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups, + @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = "true", + unspecifiedDefaultValue = "false") boolean ifExists) { + DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs = + new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists); + + Set members = getMembers(onGroups, null); + + List functionResults = + execute(new DestroyAsyncEventQueueFunction(), asyncEventQueueDestoryFunctionArgs, members); + + TabularResultData tabularResultData = ResultBuilder.createTabularResultData(); + boolean errorOccurred = false; + for (CliFunctionResult functionResult : functionResults) { + LogService.getLogger().info("FunctionResult = '" + functionResult + "'"); + tabularResultData.accumulate("Member", functionResult.getMemberIdOrName()); + if (functionResult.isSuccessful()) { + tabularResultData.accumulate("Status", functionResult.getMessage()); + } else { + // if result has exception, it will be logged by the server before throwing it. + // so we don't need to log it here anymore. + tabularResultData.accumulate("Status", "ERROR: " + functionResult.getErrorMessage()); + errorOccurred = true; + } + } + tabularResultData.setStatus(errorOccurred ? Result.Status.ERROR : Result.Status.OK); Review comment: You will need to update the cluster configuration as well. Have your function return an xmlEntity, and call a clusterConfigService.deleteXmlEntity(). Use DestroyRegionCommand as an example. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org > Add gfsh command to destroy async-event-queue > --------------------------------------------- > > Key: GEODE-2665 > URL: https://issues.apache.org/jira/browse/GEODE-2665 > Project: Geode > Issue Type: Sub-task > Components: docs, gfsh > Reporter: Swapnil Bawaskar > Assignee: Kenneth Howe > Fix For: 1.4.0 > > > Currently, there is only an {{create async-event-queue}} command in gfsh, we need the corresponding {{destroy async-event-queue}} -- This message was sent by Atlassian JIRA (v6.4.14#64029)