Skip to content

Commit

Permalink
Merge pull request bschmitt#8 from CodeYellowBV/add-ssl-options
Browse files Browse the repository at this point in the history
Add SSL options
  • Loading branch information
bschmitt committed Feb 11, 2016
2 parents 149700c + 89e90f8 commit 94435e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ return [
'exchange' => 'amq.topic',
'exchange_type' => 'topic',
'consumer_tag' => 'consumer',
'ssl_options' => [], // See https://secure.php.net/manual/en/context.ssl.php
'connect_options' => [], // See https://github.com/php-amqplib/php-amqplib/blob/master/PhpAmqpLib/Connection/AMQPSSLConnection.php
'queue_properties' => ['x-ha-policy' => ['S', 'all']],
'exchange_properties' => [],
'timeout' => 0
Expand Down
4 changes: 3 additions & 1 deletion config/amqp.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
'consumer_tag' => 'consumer',
'queue_properties' => ['x-ha-policy' => ['S', 'all']],
'exchange_properties' => [],
'connect_options' => [],
'ssl_options' => [],
'timeout' => 0
],

],

];
];
7 changes: 5 additions & 2 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Illuminate\Config\Repository;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Connection\AMQPSSLConnection;
use PhpAmqpLib\Channel\AMQPChannel;

/**
Expand Down Expand Up @@ -30,12 +31,14 @@ class Request extends Context
*/
public function connect()
{
$this->connection = new AMQPStreamConnection(
$this->connection = new AMQPSSLConnection(
$this->getProperty('host'),
$this->getProperty('port'),
$this->getProperty('username'),
$this->getProperty('password'),
$this->getProperty('vhost')
$this->getProperty('vhost'),
$this->getProperty('ssl_options'),
$this->getProperty('connect_options')
);

$this->channel = $this->connection->channel();
Expand Down

0 comments on commit 94435e0

Please sign in to comment.