5. Developer corner

Target group: Developers

Create own logic

You can use the TYPO3 JobRouter Connector as a starting point for your own logic, e.g. to synchronise JobData tables or retrieve archive documents. Since this extension relies on the JobRouter Client library, you can get a RestClient object to call the JobRouter® REST API.


To simplify the creation of this client object, a factory method is available. Let’s have a look at an example in the TYPO3 context:


use Brotkrueml\JobRouterClient\Exception\ExceptionInterface;
use Brotkrueml\JobRouterConnector\Domain\Model\Connection;
use Brotkrueml\JobRouterConnector\Domain\Repository\ConnectionRepository;
use Brotkrueml\JobRouterConnector\RestClient\RestClientFactory;

final class MyController
   private ConnectionRepository $connectionRepository;
   private RestClientFactory $restClientFactory;

   public function __construct(
      ConnectionRepository $connectionRepository,
      RestClientFactory $restClientFactory
   ) {
      $this->connectionRepository = $connectionRepository;
      $this->restClientFactory = $restClientFactory;

   public function myAction()
      $connection = $connectionRepository->findOneByHandle('example');

      if ($connection === null) {
          // The connection is not found or disabled

      try {
         $client = $this->restClientFactory->create($connection, 60);
      } catch (ExceptionInterface $e) {
         // Maybe authentication failure or HTTP error

      // Now you can call the request() method of the $client


  1. Line 24: Retrieve the Connection model class with handle example, which holds the base URL of the JobRouter® installation and the credentials. Of course, the connection must be registered first in the Connections module. But you can also instantiate a new model object.

  2. Lines 26-28: It can be the case that there is no connection model available: There is no connection with handle example or the connection is disabled. So you have to consider this case.

  3. Line 31: Create the REST client with the create() method of the RestClientFactory. The first argument is the Connection model, the second argument the optional lifetime of the authentication token. With the call the authentication is done immediately, so an exception can be thrown if a HTTP error occurs or the authentication failed. With the client object you can make the calls to the REST API. Have a look at the JobRouter Client examples.


Have a look at additional TYPO3 extensions for synchronising JobData tables or starting process instances from TYPO3.