Example #1
0
 /**
  * Creates a message instance from a file.
  *
  * @param string $file - File.
  *
  * @return Message
  */
 public function createMessageFromFile(string $file) : Message
 {
     if (!is_file($file)) {
         throw new \InvalidArgumentException('File "' . $file . '" does not exist!');
     }
     $config = new Config();
     $config->load(['file' => $file]);
     if (!$config->has('body')) {
         throw new \RuntimeException('File has no "body" element.');
     }
     return $this->createMessage($config->get('body'), $config->get('headers', []), $config->get('options', []));
 }
Example #2
0
 /**
  * Instantiates a service.
  *
  * @return Service
  */
 public function createService()
 {
     return new Service($this->_config->get('components.ironedge/activemq'));
 }