Khaled sb
Khaled sb

Reputation: 1

Predis sub/pub on multiple channels with laravel

**Hi every one **,

I'm using predis with laravel in microservice architecture, and I have the following scenario :

App 1 :

Redis::connection('timeslot')->publish('timeslot/updateStatus', json_encode([
    'timeslot' => $this->timeSlot,
    'customer' => $this->file->customer_id
]));

App2:

static::updated(function (TimeSlot $model) {
if($model->isDirty('state') && $model->state->value === 'booked'){
      $result = json_encode(array_merge($model->toArray(), $model->agency->toArray()));
           Redis::connection('event')->publish('timeslot/booked', $result);
      }
});

when executing this part I would have the following error:

fclose(): supplied resource is not a valid stream resource

at vendor/predis/predis/src/Connection/StreamConnection.php:247
    243▕      */
    244▕     public function disconnect()
    245▕     {
    246▕         if ($this->isConnected()) {
  ➜ 247▕             fclose($this->getResource());
    248▕             parent::disconnect();
    249▕         }
    250▕     }
    251▕ 

Diagram Any help please. Thank you

I tried to do it on same channel but also i got an error

Upvotes: 0

Views: 128

Answers (0)

Related Questions