Is it possible to override/replace an event subscriber I would like to replace an event subscriber. Is there any way that I can write my class implementing EventSubscriberInterface which would replace another existing event subscriber instead of being performed earlier or later that the one existing.
You can do this by creating a ServiceProvider class.

Example service provider class to override the path_subscriber service.

namespace Drupal\MY_MODULE;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;

// @note: You only need Reference, if you want to change service arguments.
use Symfony\Component\DependencyInjection\Reference;

/**
 * Modifies the path_subscriber service.
 */
class MyModuleServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    // Overrides language_manager class to test domain language negotiation.
    // Adds entity_type.manager service as an additional argument.
    $definition = $container-&gt;getDefinition('path_subscriber');
    $definition-&gt;setClass('Drupal\MY_MODULE\MyCustomPathSubscriber')
      // Custom arguments.
      -&gt;addArgument(new Reference('some_argument'));
  }
}


Another solution is to override the service in MY_MODULE.services.yml, like this:

path_subscriber:
  class: Drupal\MY_MODULE\MyCustomPathSubscriber
  arguments: [# The arguments]