code: public CompletableFuture<Void> registerEventProcessorFactory(IEventProcessorFactory<?> factory, EventProcessorOptions processorOptions) {
          if (this.unregistered != null) {
              throw new IllegalStateException("Register cannot be called on an EventProcessorHost after unregister. Please create a new EventProcessorHost instance.");
          }
          if (this.hostContext.getEventProcessorFactory() != null) {
              throw new IllegalStateException("Register has already been called on this EventProcessorHost");
          }
  
          this.hostContext.setEventProcessorFactory(factory);
          this.hostContext.setEventProcessorOptions(processorOptions);
  
          if (this.executorService.isShutdown() || this.executorService.isTerminated()) {
              TRACE_LOGGER.warn(this.hostContext.withHost("Calling registerEventProcessor/Factory after executor service has been shut down."));
              throw new RejectedExecutionException("EventProcessorHost executor service has been shut down");
          }
  
          if (this.initializeLeaseManager) {
              try {
                  ((AzureStorageCheckpointLeaseManager) this.hostContext.getLeaseManager()).initialize(this.hostContext);
              } catch (InvalidKeyException | URISyntaxException | StorageException e) {
                  TRACE_LOGGER.error(this.hostContext.withHost("Failure initializing default lease and checkpoint manager."));
                  throw new RuntimeException("Failure initializing Storage lease manager", e);
              }
          }
  
          TRACE_LOGGER.info(this.hostContext.withHost("Starting event processing."));
  
          return this.partitionManager.initialize();
      }
docs: Register user-supplied event processor factory and start processing.
  <p>
  This overload takes user-specified options.
  <p>
  The returned CompletableFuture completes when host initialization is finished. Initialization failures are
  reported by completing the future with an exception, so it is important to call get() on the future and handle
  any exceptions thrown.
  
  @param factory          User-supplied event processor factory object.
  @param processorOptions Options for the processor host and event processor(s).
  @return Future that completes when initialization is finished.