/** @inheritDoc */
  @Override
  public void export(final ExportInstanceRequest request) {
    this.request = request;
    this.workflowId =
        contextProvider
            .getDecisionContext()
            .getWorkflowContext()
            .getWorkflowExecution()
            .getWorkflowId();

    Promise<Void> started = controlActivities.notifyJobStarted();
    doExport(started);
  }
  @Asynchronous
  private void exportWithSnapshot() {
    final Promise<DatabaseInstance> database =
        rdsActivities.describeInstance(request.getInstanceName(), request.getIdentity());
    final Promise<String> snapshotName =
        controlActivities.createSnapshotName(request.getInstanceName());
    Promise<Void> done =
        rdsActivities.createSnapshot(
            snapshotName,
            Promise.asPromise(request.getInstanceName()),
            Promise.asPromise(request.getIdentity()),
            database);
    new TryCatchFinally(done) {
      @Override
      protected void doCatch(Throwable cause) {
        controlActivities.notifyJobFailed(cause);
      }

      @Override
      protected void doFinally() throws Throwable {
        rdsActivities.deleteSnapshot(snapshotName, Promise.asPromise(request.getIdentity()));
      }

      @Override
      protected void doTry() {
        Promise<Void> done = waitUntilSnapshotAvailable(snapshotName);
        Promise<ExportSnapshotRequest> snapshotRequest =
            createExportSnapshotRequest(snapshotName, database);
        done =
            exportSnapshotFlowFactory
                .getClient(workflowId + "-snapshot")
                .export(snapshotRequest, done);
        controlActivities.notifyJobCompleted(done);
      }
    };
  }