Skip to content

Commit

Permalink
FEATURE: Allow configuration of RabbitMq heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
paxuclus committed Apr 20, 2020
1 parent 1c02b8a commit cd0dcb5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Classes/Queue/RabbitQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,24 @@ public function __construct(string $name, array $options = [])
$vhost = $clientOptions['vhost'] ?? '/';
$insist = isset($clientOptions['insist']) ? (bool) $clientOptions['insist'] : false;
$loginMethod = isset($clientOptions['loginMethod']) ? (string) $clientOptions['loginMethod'] : 'AMQPLAIN';

$this->connection = new AMQPStreamConnection($host, $port, $username, $password, $vhost, $insist, $loginMethod, null, 'en_US', 3.0, 3.0, null, true, 0);
$heartbeat = (int) ($clientOptions['heartbeat'] ?? 0);

$this->connection = new AMQPStreamConnection(
$host,
$port,
$username,
$password,
$vhost,
$insist,
$loginMethod,
null,
'en_US',
3.0,
3.0,
null,
true,
$heartbeat
);
$this->channel = $this->connection->channel();

// a worker should only get one message at a time
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Flowpack:
port: 5672
username: guest
password: guest
heartbeat: 60 # Sets RabbitMQ connection heartbeat to 60 seconds

queues:
producer-import:
Expand Down

0 comments on commit cd0dcb5

Please sign in to comment.