protected function preprocessSendNotification($parsed_tx, $confirmations, $block_seq, $block) { // throw this transaction into the counterpartyd verification queue $data = ['tx' => $parsed_tx, 'confirmations' => $confirmations, 'block_seq' => $block_seq, 'block_id' => $block['id']]; // Log::debug("pushing ValidateConfirmedCounterpartydTxJob ".json_encode($data['block_id'], 192)); Queue::connection('blockingbeanstalkd')->push('App\\Jobs\\XChain\\ValidateConfirmedCounterpartydTxJob', $data, 'validate_counterpartytx'); }
if (!empty($route_url)) { Route::post($route_url, function () { $listener_type = Config::get('aftership-laravel::web_hook.listener.type'); $handler = Config::get('aftership-laravel::web_hook.listener.handler'); if (empty($listener_type) || empty($handler)) { throw new Exception('Listener Configuration is incomplete.'); } if ($listener_type == "event") { Event::fire($handler, array('data' => Input::all())); } elseif ($listener_type == "queue") { $queue_connection = Config::get('aftership-laravel::web_hook.listener.queue_connection'); $queue_name = Config::get('aftership-laravel::web_hook.listener.queue_name'); if (empty($queue_connection)) { if (empty($queue_name)) { Queue::push($handler, array('data' => Input::all())); } else { Queue::push($handler, array('data' => Input::all()), $queue_name); } } else { if (empty($queue_name)) { Queue::connection($queue_connection)->push($handler, array('data' => Input::all())); } else { Queue::connection($queue_connection)->push($handler, array('data' => Input::all()), $queue_name); } } } }); } else { throw new Exception('Route URL cannot be empty when Webhook is enabled.'); } }
/** * Checks the system meets all the requirements needed to run Deployer. * * @return bool */ protected function checkRequirements() { $errors = false; // Check PHP version: if (!version_compare(PHP_VERSION, '5.5.9', '>=')) { $this->error('PHP 5.5.9 or higher is required'); $errors = true; } // Check for required PHP extensions $required_extensions = ['PDO', 'curl', 'gd', 'json', 'tokenizer', 'openssl', 'mbstring']; foreach ($required_extensions as $extension) { if (!extension_loaded($extension)) { $this->error('Extension required: ' . $extension); $errors = true; } } if (!count($this->getDatabaseDrivers())) { $this->error('At least 1 PDO driver is required. Either sqlite, mysql, pgsql or sqlsrv, check your php.ini file'); $errors = true; } // Functions needed by symfony process $required_functions = ['proc_open']; foreach ($required_functions as $function) { if (!function_exists($function)) { $this->error('Function required: ' . $function . '. Is it disabled in php.ini?'); $errors = true; } } // Programs needed in $PATH $required_commands = ['ssh', 'ssh-keygen', 'git', 'scp', 'tar', 'gzip', 'rsync', 'bash']; foreach ($required_commands as $command) { $process = new Process('which ' . $command); $process->setTimeout(null); $process->run(); if (!$process->isSuccessful()) { $this->error('Program not found in path: ' . $command); $errors = true; } } $required_one = ['node', 'nodejs']; $found = false; foreach ($required_one as $command) { $process = new Process('which ' . $command); $process->setTimeout(null); $process->run(); if ($process->isSuccessful()) { $found = true; break; } } if (!$found) { $this->error('node.js was not found'); $errors = true; } // Files and directories which need to be writable $writable = ['.env', 'storage', 'storage/logs', 'storage/app', 'storage/app/mirrors', 'storage/app/tmp', 'storage/framework', 'storage/framework/cache', 'storage/framework/sessions', 'storage/framework/views', 'bootstrap/cache', 'public/upload']; foreach ($writable as $path) { if (!is_writeable(base_path($path))) { $this->error($path . ' is not writeable'); $errors = true; } } // Check that redis is running try { Redis::connection()->ping(); } catch (\Exception $e) { $this->error('Redis is not running'); $errors = true; } if (config('queue.default') === 'beanstalkd') { $connected = Queue::connection()->getPheanstalk()->getConnection()->isServiceListening(); if (!$connected) { $this->error('Beanstalkd is not running'); $errors = true; } } if ($errors) { $this->line(''); $this->block('Deployer cannot be installed. Please review the errors above before continuing.'); $this->line(''); return false; } return true; }
public function getQueueSize($queue_name, $connection = null) { $pheanstalk = Queue::connection($connection)->getPheanstalk(); $stats = $pheanstalk->statsTube($queue_name); return $stats['current-jobs-urgent']; }