I’m using yiisoft/yii2-httpclient
extension for consuming a web service. i have a controller to create a new record in webservice. for any reason the action create can be fail (timeout, ws is down, and others) it is correct put this action create inside a queue (like the yiisoft/yii2-queue
) if the record fails, retry in the background?
controller.php
public function actionCreate()
{
$client = new Client();
$response = $client->createRequest()
->setMethod('POST')
->setUrl('http://******/rooms')
->setData([
'name' => $model->name,
'date' => $model->date,
])
->send();
if ($response->isOk) {
return $this->redirect(['index']);
}
}