$connectMethod = 'true'
=== ($this->connectionOptions
['persistent'
] ?? 'false'
) ? 'pconnect' : 'connect';
try { $connection->
{$connectMethod}();
} catch (\AMQPConnectionException
$e) { throw new \
AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.', 0,
$e);
} $this->amqpChannel =
$this->amqpFactory->
createChannel($connection);
if (''
!== ($this->connectionOptions
['confirm_timeout'
] ?? ''
)) { $this->amqpChannel->
confirmSelect();
$this->amqpChannel->
setConfirmCallback( static fn (): bool => false,
static fn (): bool => false
);
} $this->lastActivityTime =
time();
} elseif (0 <
($this->connectionOptions
['heartbeat'
] ?? 0
) &&
time() >
$this->lastActivityTime + 2 *
$this->connectionOptions
['heartbeat'
]) { $disconnectMethod = 'true'
=== ($this->connectionOptions
['persistent'
] ?? 'false'
) ? 'pdisconnect' : 'disconnect';
$this->amqpChannel->
getConnection()->
{$disconnectMethod}();
}