Drupal modules for browsing and managing Fedora-based digital repositories.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Drupal\islandora;
|
|
|
|
|
|
|
|
use Drupal\Core\Config\ConfigFactoryInterface;
|
|
|
|
use Drupal\islandora\Form\IslandoraSettingsForm;
|
|
|
|
use Stomp\Client;
|
|
|
|
use Stomp\StatefulStomp;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* StatefulStomp static factory.
|
|
|
|
*/
|
|
|
|
class StompFactory {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Factory function.
|
|
|
|
*
|
|
|
|
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
|
|
|
|
* Config.
|
|
|
|
*
|
|
|
|
* @return \Stomp\StatefulStomp
|
|
|
|
* Stomp client.
|
|
|
|
*/
|
|
|
|
public static function create(ConfigFactoryInterface $config) {
|
|
|
|
// Get broker url from config.
|
|
|
|
$settings = $config->get(IslandoraSettingsForm::CONFIG_NAME);
|
|
|
|
$brokerUrl = $settings->get(IslandoraSettingsForm::BROKER_URL);
|
|
|
|
|
|
|
|
$client = new Client($brokerUrl);
|
|
|
|
return new StatefulStomp($client);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|