public function __construct(array $options = [])
{
$this->setOptions($options);
if (!isset($options[self::P_APP_ID])) {
$this->appId = self::DEFAULT_APP_ID;
}
if (!isset($options[self::P_QUEUE]) || !$options[self::P_QUEUE] instanceof Queue) {
$this->queue = new Queue();
$this->queue->setProducer($this);
}
if (!isset($options[self::P_LOGGER]) || !$options[self::P_LOGGER] instanceof \Psr\Log\LoggerInterface) {
$this->logger = new Logger\Journal();
}
if (!isset($options[self::P_REDIS]) || !$options[self::P_REDIS] instanceof Client) {
$this->redis = new Client(self::DEFAULT_REDIS_SERVER);
}
if (!isset($options[self::P_STORAGE]) || !$options[self::P_STORAGE] instanceof StorageInterface) {
$this->storage = new Storage\Redis($this->appId);
}
}