Skip to content
Snippets Groups Projects
Commit ab1efa1b authored by Sergio Vier's avatar Sergio Vier :mountain_bicyclist_tone1:
Browse files

Merge branch 'feature/fix-cambio-estado-error-worker' into 'develop'

Control de tipos al encolar el cambio de estado de error en el worker de emails

See merge request !125
parents 4adf21bd 78ba49ad
No related branches found
No related tags found
1 merge request!125Control de tipos al encolar el cambio de estado de error en el worker de emails
Pipeline #1237 passed with warnings with stages
in 2 minutes and 19 seconds
......@@ -78,7 +78,7 @@ class SendMailProcessor implements Processor
if (empty($result['failures'])) {
$this->retries($params);
} else {
$this->cambiarEstadoSolicitud($params);
$this->cambiarEstadoError($params);
}
} else {
$this->logger->debug('Se envió exitosamente el mensaje', $datosLog);
......@@ -110,19 +110,32 @@ class SendMailProcessor implements Processor
} else {
unset($params['retries']);
$this->logger->error("Límites de reintentos alcanzado ({$this->retries})", $datosLog);
$this->cambiarEstadoSolicitud($params);
$this->cambiarEstadoError($params);
}
} catch (\Exception $e) {
$this->logger->error($e->getMessage(), $datosLog);
}
}
private function cambiarEstadoSolicitud(array $params)
/**
* Reencola el mensaje con el estado de error dependiendo el tipo de notificación
*
* @param array $params
*/
private function cambiarEstadoError(array $params)
{
if (isset($params['tipo']) && $params['tipo'] == Notificacion::TIPO_SOLICITUD_REGISTRO) {
$this->transport->sendMessageToQueue(Registro::QUEUE_CAMBIO_ESTADO_REGISTRO, json_encode(['estado' => Registro::ESTADO_SOLICITUD_ERROR, 'identificador' => $params['datos']['identificador']]));
} else {
$this->transport->sendMessageToQueue(Registro::QUEUE_CAMBIO_ESTADO_REGISTRO, json_encode(['estado' => Registro::ESTADO_REGISTRO_ERROR, 'identificador' => $params['datos']['identificador']]));
if (isset($params['tipo'])) {
switch ($params['tipo']) {
case $params['tipo'] == Notificacion::TIPO_SOLICITUD_REGISTRO:
case $params['tipo'] == Notificacion::TIPO_SOLICITUD_ENVIADA:
$this->transport->sendMessageToQueue(Registro::QUEUE_CAMBIO_ESTADO_REGISTRO, json_encode(['estado' => Registro::ESTADO_SOLICITUD_ERROR, 'identificador' => $params['datos']['identificador']]));
break;
case $params['tipo'] == Notificacion::TIPO_PROCESAR_REGISTRO:
case $params['tipo'] == Notificacion::TIPO_PROCESADA_CREADA:
case $params['tipo'] == Notificacion::TIPO_PROCESADA_VINCULADA:
$this->transport->sendMessageToQueue(Registro::QUEUE_CAMBIO_ESTADO_REGISTRO, json_encode(['estado' => Registro::ESTADO_REGISTRO_ERROR, 'identificador' => $params['datos']['identificador']]));
break;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment