Commit accd06327a09fa4865d91a17c6e2ea0d01c48006
1 parent
2fc5620f
Exists in
master
and in
13 other branches
[Fixed #92] Ajuste para não interromper monitoramento de pendências em situações de falha
Showing
4 changed files
with
26 additions
and
18 deletions
Show diff stats
rn/PendenciasTramiteRN.php
@@ -71,17 +71,22 @@ class PendenciasTramiteRN extends InfraRN { | @@ -71,17 +71,22 @@ class PendenciasTramiteRN extends InfraRN { | ||
71 | $arrQuantidadeErrosTramite = array(); | 71 | $arrQuantidadeErrosTramite = array(); |
72 | 72 | ||
73 | while (true) { | 73 | while (true) { |
74 | - $this->gravarLogDebug('Recuperando lista de pendências do PEN', 1); | ||
75 | - $arrObjPendenciasDTO = $this->obterPendenciasTramite(); | ||
76 | - foreach ($arrObjPendenciasDTO as $objPendenciaDTO) { | ||
77 | - $mensagemLog = sprintf(">>> Enviando pendência %d (status %s) para fila de processamento", | ||
78 | - $objPendenciaDTO->getNumIdentificacaoTramite(), $objPendenciaDTO->getStrStatus()); | ||
79 | - $this->gravarLogDebug($mensagemLog, 3, true); | ||
80 | - $this->enviarPendenciaFilaProcessamento($objPendenciaDTO); | 74 | + try { |
75 | + $this->gravarLogDebug('Recuperando lista de pendências do PEN', 1); | ||
76 | + $arrObjPendenciasDTO = $this->obterPendenciasTramite(); | ||
77 | + foreach ($arrObjPendenciasDTO as $objPendenciaDTO) { | ||
78 | + $mensagemLog = sprintf(">>> Enviando pendência %d (status %s) para fila de processamento", | ||
79 | + $objPendenciaDTO->getNumIdentificacaoTramite(), $objPendenciaDTO->getStrStatus()); | ||
80 | + $this->gravarLogDebug($mensagemLog, 3, true); | ||
81 | + $this->enviarPendenciaFilaProcessamento($objPendenciaDTO); | ||
82 | + } | ||
83 | + } catch (Exception $e) { | ||
84 | + //Apenas registra a falha no log do sistema e reinicia o ciclo de requisição | ||
85 | + LogSEI::getInstance()->gravar(InfraException::inspecionar($e)); | ||
86 | + } finally { | ||
87 | + $this->gravarLogDebug("Reiniciando monitoramento de pendências", 1); | ||
88 | + sleep(5); | ||
81 | } | 89 | } |
82 | - | ||
83 | - $this->gravarLogDebug("Reiniciando monitoramento de pendências", 1); | ||
84 | - sleep(5); | ||
85 | } | 90 | } |
86 | } | 91 | } |
87 | catch(Exception $e) { | 92 | catch(Exception $e) { |
rn/ProcessarPendenciasRN.php
@@ -33,9 +33,9 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa | @@ -33,9 +33,9 @@ class ProcessarPendenciasRN extends InfraAgendamentoTarefa | ||
33 | ini_set('max_execution_time','0'); | 33 | ini_set('max_execution_time','0'); |
34 | ini_set('memory_limit','-1'); | 34 | ini_set('memory_limit','-1'); |
35 | 35 | ||
36 | - InfraDebug::getInstance()->setBolLigado(false); | 36 | + InfraDebug::getInstance()->setBolLigado(true); |
37 | InfraDebug::getInstance()->setBolDebugInfra(false); | 37 | InfraDebug::getInstance()->setBolDebugInfra(false); |
38 | - InfraDebug::getInstance()->setBolEcho(false); | 38 | + InfraDebug::getInstance()->setBolEcho(true); |
39 | InfraDebug::getInstance()->limpar(); | 39 | InfraDebug::getInstance()->limpar(); |
40 | 40 | ||
41 | PENIntegracao::validarCompatibilidadeModulo(); | 41 | PENIntegracao::validarCompatibilidadeModulo(); |
rn/ReceberComponenteDigitalRN.php
@@ -100,11 +100,14 @@ class ReceberComponenteDigitalRN extends InfraRN | @@ -100,11 +100,14 @@ class ReceberComponenteDigitalRN extends InfraRN | ||
100 | $strHashDoArquivo = hash_file("sha256", $strCaminhoAnexo, true); | 100 | $strHashDoArquivo = hash_file("sha256", $strCaminhoAnexo, true); |
101 | 101 | ||
102 | if(strcmp($strHashInformado, $strHashDoArquivo) != 0) { | 102 | if(strcmp($strHashInformado, $strHashDoArquivo) != 0) { |
103 | - | ||
104 | - $this->objProcessoEletronicoRN->recusarTramite($parNumIdentificacaoTramite, "Hash do componente digital não confere com o valor informado pelo remetente.", ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_CORROMPIDO); | ||
105 | - | ||
106 | - // Adiciono nos detalhes o nome do método para poder manipular o cache | ||
107 | - throw new InfraException("Hash do componente digital não confere com o valor informado pelo remetente.", null, __METHOD__); | 103 | + $strMensagem = "Hash do componente digital não confere com o valor informado pelo remetente."; |
104 | + $this->objProcessoEletronicoRN->recusarTramite($parNumIdentificacaoTramite, $strMensagem, ProcessoEletronicoRN::MTV_RCSR_TRAM_CD_CORROMPIDO); | ||
105 | + | ||
106 | + $strHashInformadoBase64 = base64_encode($strHashInformado); | ||
107 | + $strHashDoArquivoBase64 = base64_encode($strHashDoArquivo); | ||
108 | + $strDetalhes = "Hash do componente digital informado pelo PEN: $strHashInformadoBase64 \n"; | ||
109 | + $strDetalhes .= "Hash do componente digital calculado pelo SEI: $strHashDoArquivoBase64 \n"; | ||
110 | + throw new InfraException($strMensagem, null, $strDetalhes); | ||
108 | } | 111 | } |
109 | } | 112 | } |
110 | 113 |
rn/ReceberProcedimentoRN.php
@@ -217,7 +217,7 @@ class ReceberProcedimentoRN extends InfraRN | @@ -217,7 +217,7 @@ class ReceberProcedimentoRN extends InfraRN | ||
217 | } | 217 | } |
218 | } | 218 | } |
219 | } | 219 | } |
220 | - //$this->fecharProcedimentoEmOutraUnidades($objProcedimentoDTO, $objMetadadosProcedimento); | 220 | + |
221 | $this->gravarLogDebug("Enviando recibo de conclusão do trâmite $parNumIdentificacaoTramite", 6); | 221 | $this->gravarLogDebug("Enviando recibo de conclusão do trâmite $parNumIdentificacaoTramite", 6); |
222 | $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); | 222 | $objEnviarReciboTramiteRN = new EnviarReciboTramiteRN(); |
223 | $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($parNumIdentificacaoTramite, $arrayHash); | 223 | $objEnviarReciboTramiteRN->enviarReciboTramiteProcesso($parNumIdentificacaoTramite, $arrayHash); |