@Override
  public void execute(FunctionContext<DestroyAsyncEventQueueFunctionArgs> context) {
    DestroyAsyncEventQueueFunctionArgs aeqArgs =
        context.getArguments();
    String aeqId = aeqArgs.getId();
    String memberId = context.getMemberName();

    try {
      AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) context.getCache().getAsyncEventQueue(aeqId);
      if (aeq == null) {
        if (aeqArgs.isIfExists()) {
          context.getResultSender()
              .lastResult(new CliFunctionResult(memberId, true,
                  String.format(
                      "Skipping: "
                          + DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND,
                      aeqId)));
        } else {
          context.getResultSender().lastResult(new CliFunctionResult(memberId, false, String.format(
              DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND, aeqId)));
        }
      } else {
        // this is the XmlEntity that needs to be removed from the cluster config
        XmlEntity xmlEntity = getAEQXmlEntity("id", aeqId);

        aeq.stop();
        aeq.destroy();

        @SuppressWarnings("deprecation")
        final CliFunctionResult lastResult =
            new CliFunctionResult(memberId, xmlEntity, String.format(
                DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED, aeqId));
        context.getResultSender()
            .lastResult(lastResult);
      }
    } catch (Exception e) {
      context.getResultSender().lastResult(new CliFunctionResult(memberId, e, e.getMessage()));
    }
  }
Function used by the 'destroy async-event-queue' gfsh command to destroy an asynchronous event
queue on a member.
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunction.java