Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Config Class Reference
Inheritance diagram for Config:
Config

Public Member Functions

 __construct (DeploymentConfig $config, $connectionName='amqp', ConnectionFactory $connectionFactory=null)
 
 __destruct ()
 
 getValue ($key)
 
 getChannel ()
 

Data Fields

const QUEUE_CONFIG = 'queue'
 
const AMQP_CONFIG = 'amqp'
 
const HOST = 'host'
 
const PORT = 'port'
 
const USERNAME = 'user'
 
const PASSWORD = 'password'
 
const VIRTUALHOST = 'virtualhost'
 
const SSL = 'ssl'
 
const SSL_OPTIONS = 'ssl_options'
 

Detailed Description

Reads the Amqp config in the deployed environment configuration

@api

Since
100.0.0

Definition at line 21 of file Config.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( DeploymentConfig  $config,
  $connectionName = 'amqp',
ConnectionFactory  $connectionFactory = null 
)

Initialize dependencies.

Example environment config: 'queue' => [ 'amqp' => [ 'host' => 'localhost', 'port' => 5672, 'username' => 'guest', 'password' => 'guest', 'virtual_host' => '/', 'ssl' => false, 'ssl_options' => [], ], ],

Parameters
DeploymentConfig$config
string$connectionName
ConnectionFactory | null$connectionFactory
Since
100.0.0

Definition at line 101 of file Config.php.

105  {
106  $this->deploymentConfig = $config;
107  $this->connectionName = $connectionName;
108  $this->connectionFactory = $connectionFactory
109  ?: ObjectManager::getInstance()->get(ConnectionFactory::class);
110  }
$config
Definition: fraud_order.php:17

◆ __destruct()

__destruct ( )

Destructor

Returns
void
Since
100.0.0

Definition at line 118 of file Config.php.

119  {
120  $this->closeConnection();
121  }

Member Function Documentation

◆ getChannel()

getChannel ( )

Return Amqp channel

Returns
AMQPChannel
Exceptions

Definition at line 165 of file Config.php.

166  {
167  if (!isset($this->connection) || !isset($this->channel)) {
168  $this->connection = $this->createConnection();
169 
170  $this->channel = $this->connection->channel();
171  }
172  return $this->channel;
173  }

◆ getValue()

getValue (   $key)

Returns the configuration set for the key.

Parameters
string$key
Returns
string
Exceptions

Definition at line 131 of file Config.php.

132  {
133  $this->load();
134  return isset($this->data[$key]) ? $this->data[$key] : null;
135  }

Field Documentation

◆ AMQP_CONFIG

const AMQP_CONFIG = 'amqp'

Amqp config key

Definition at line 31 of file Config.php.

◆ HOST

const HOST = 'host'

Definition at line 33 of file Config.php.

◆ PASSWORD

const PASSWORD = 'password'

Definition at line 36 of file Config.php.

◆ PORT

const PORT = 'port'

Definition at line 34 of file Config.php.

◆ QUEUE_CONFIG

const QUEUE_CONFIG = 'queue'

Queue config key

Definition at line 26 of file Config.php.

◆ SSL

const SSL = 'ssl'

Definition at line 38 of file Config.php.

◆ SSL_OPTIONS

const SSL_OPTIONS = 'ssl_options'

Definition at line 39 of file Config.php.

◆ USERNAME

const USERNAME = 'user'

Definition at line 35 of file Config.php.

◆ VIRTUALHOST

const VIRTUALHOST = 'virtualhost'

Definition at line 37 of file Config.php.


The documentation for this class was generated from the following file: