Skip to content

Instantly share code, notes, and snippets.

@tuscanicz
Created May 27, 2016 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuscanicz/0630af2efdde535646dfb4fc40f1e5e2 to your computer and use it in GitHub Desktop.
Save tuscanicz/0630af2efdde535646dfb4fc40f1e5e2 to your computer and use it in GitHub Desktop.
<?php
namespace KutnyLib\RabbitMq;
use PhpAmqpLib\Connection\AbstractConnection;
class AmqpChannelFactory
{
private $connection;
public function __construct(
AbstractConnection $connection
) {
$this->connection = $connection;
}
public function createChannelFromPid()
{
$channelId = getmypid() % 65535;
return $this->connection->channel($channelId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment