Implemented WebHooks delivery queue.

Completely removed usage of the RabbitMQ. Queue now based on Redis channels.
Worker process now extracted as separate docker container.
Base image upgraded to the 1.8.0 version (PHP 7.2.7 and pcntl extension).
This commit is contained in:
ErickSkrauch
2018-07-08 18:20:19 +03:00
parent 6751eb6591
commit c0aa78d156
55 changed files with 933 additions and 1684 deletions

View File

@@ -16,43 +16,35 @@ class Key {
$this->key = $this->buildKey($key);
}
public function getRedis(): Connection {
return Yii::$app->redis;
}
public function getKey(): string {
return $this->key;
}
public function getValue() {
return $this->getRedis()->get($this->key);
return Yii::$app->redis->get($this->key);
}
public function setValue($value): self {
$this->getRedis()->set($this->key, $value);
Yii::$app->redis->set($this->key, $value);
return $this;
}
public function delete(): self {
$this->getRedis()->del([$this->getKey()]);
Yii::$app->redis->del($this->getKey());
return $this;
}
public function exists(): bool {
return (bool)$this->getRedis()->exists($this->key);
return (bool)Yii::$app->redis->exists($this->key);
}
public function expire(int $ttl): self {
$this->getRedis()->expire($this->key, $ttl);
Yii::$app->redis->expire($this->key, $ttl);
return $this;
}
public function expireAt(int $unixTimestamp): self {
$this->getRedis()->expireat($this->key, $unixTimestamp);
Yii::$app->redis->expireat($this->key, $unixTimestamp);
return $this;
}