libretificacaotjcore 0.1.39__py3-none-any.whl → 0.1.41__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of libretificacaotjcore might be problematic. Click here for more details.

@@ -9,23 +9,24 @@ class EFaseRetificacao(Enum):
9
9
  ExtraindoDadosDoXml = 4
10
10
  AguardandoRubrica = 5
11
11
  EstruturandoXmlAberturaCompetencia = 6
12
- EstruturandoXmlExclusaoPagamentos = 7
13
- EstruturandoXmlRetificacaoRemuneracao = 8
14
- EstruturandoXmlInclusaoPagamentos = 9
15
- EstruturandoXmlDesligamento = 10
16
- EstruturandoXmlFechamentoCompetencia = 11
17
- AberturaDeCompetencia = 12
18
- ConsultandoESocialAberturaCompetencia = 13
19
- InclusaoDasRubricas = 14
20
- ConsultandoESocialInclusaoRubricas = 15
21
- ExclusaoDePagamentos = 16
22
- ConsultandoESocialExclusaoPagamentos = 17
23
- RetificacaoDaRemuneracao = 18
24
- ConsultandoESocialRetificacaoRemuneracao = 19
25
- InclusaoDosPagamentos = 20
26
- ConsultandoESocialInclusaoPagamentos = 21
27
- Desligamento = 22
28
- ConsultandoESocialDesligamento = 23
29
- FechamentoDeCompetencia = 24
30
- ConsultandoESocialFechamentoCompetencia = 25
31
- Finalizado = 26
12
+ EstruturandoXmlInclusaoRubricas = 7
13
+ EstruturandoXmlExclusaoPagamentos = 8
14
+ EstruturandoXmlRetificacaoRemuneracao = 9
15
+ EstruturandoXmlInclusaoPagamentos = 10
16
+ EstruturandoXmlDesligamento = 11
17
+ EstruturandoXmlFechamentoCompetencia = 12
18
+ AberturaDeCompetencia = 13
19
+ ConsultandoESocialAberturaCompetencia = 14
20
+ InclusaoDasRubricas = 15
21
+ ConsultandoESocialInclusaoRubricas = 16
22
+ ExclusaoDePagamentos = 17
23
+ ConsultandoESocialExclusaoPagamentos = 18
24
+ RetificacaoDaRemuneracao = 19
25
+ ConsultandoESocialRetificacaoRemuneracao = 20
26
+ InclusaoDosPagamentos = 21
27
+ ConsultandoESocialInclusaoPagamentos = 22
28
+ Desligamento = 23
29
+ ConsultandoESocialDesligamento = 24
30
+ FechamentoDeCompetencia = 25
31
+ ConsultandoESocialFechamentoCompetencia = 26
32
+ Finalizado = 27
@@ -1,3 +1,4 @@
1
+ import asyncio
1
2
  import aio_pika
2
3
  import json
3
4
 
@@ -31,22 +32,27 @@ class RabbitMQConsumer:
31
32
  await self.channel.set_qos(prefetch_count=1)
32
33
  await self.channel.declare_queue(self.queue, durable=True)
33
34
 
34
- async def start_consuming(self, *, callback):
35
+ async def start_consuming(self, callback):
35
36
  if not self.channel:
36
37
  raise RuntimeError("❌ Canal RabbitMQ não conectado. Chame connect() antes.")
37
38
 
38
39
  queue = await self.channel.get_queue(self.queue)
39
40
 
40
- async with queue.iterator() as queue_iter:
41
- async for message in queue_iter:
42
- async with message.process():
43
- try:
44
- mensagem = json.loads(message.body.decode())
45
- await callback(mensagem)
46
- except Exception as e:
47
- print(f"Erro ao processar mensagem: {e}")\
48
-
49
- await self.close()
41
+ async def on_message(message):
42
+ async with message.process():
43
+ try:
44
+ mensagem = json.loads(message.body.decode())
45
+ await callback(mensagem) # aqui sim passa o DTO
46
+ except Exception as e:
47
+ print(f"❌ Erro ao processar mensagem: {e}")
48
+
49
+ await queue.consume(on_message) # registra callback
50
+
51
+ print(f'[*] Aguardando mensagens na fila "{self.queue}". Para sair pressione CTRL+C')
52
+
53
+ # Mantém o consumer rodando
54
+ await asyncio.Future()
55
+
50
56
 
51
57
  async def close(self):
52
58
  if self.connection:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libretificacaotjcore
3
- Version: 0.1.39
3
+ Version: 0.1.41
4
4
  Summary: Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ
5
5
  Author-email: Jhonatan Azevedo <dev.azevedo@outlook.com>
6
6
  Project-URL: Homepage, https://github.com/seu-usuario/libretificacaotjcore
@@ -9,15 +9,15 @@ libretificacaotjcore/dtos/arquivo_dto.py,sha256=D4LLJZf-Z0XhJmOvu7nAcBq0j70m9TFt
9
9
  libretificacaotjcore/dtos/solicitacao_dto.py,sha256=dmI-JGgE0wZ9zXqej6pqSIIaopkROnBQo2Hj3pEXcZ8,2576
10
10
  libretificacaotjcore/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  libretificacaotjcore/enums/e_eventos.py,sha256=EClyRpHtL21t_s1b_26bbBKpvd6QgOtIe87FmSzh34E,185
12
- libretificacaotjcore/enums/e_fase_retificacao.py,sha256=g7xVlIMKpo9QUDnOdwYzsx8ojYt5s29JKs8FFIB5Dxk,1032
12
+ libretificacaotjcore/enums/e_fase_retificacao.py,sha256=v7ERN6MuhdiuT2Yhzu5yzvR6rpKaxqoNMKrBlk4zhkY,1074
13
13
  libretificacaotjcore/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  libretificacaotjcore/services/crypto_pass_service.py,sha256=9D0vyjan6f_8AfNxGkLpGdvyMpojsJq_AAySpv_zKMc,740
15
15
  libretificacaotjcore/services/file_service.py,sha256=14CJokBbrsryQGmL0_unH2QKZpnteEAfxf5CPFdv6cE,2075
16
- libretificacaotjcore/services/rabbitmq_consumer.py,sha256=aw2NaPkuF1AewJh2dQetTsZVvFlimjw96o5r-jnu86A,1687
16
+ libretificacaotjcore/services/rabbitmq_consumer.py,sha256=yRS3sAkaMIIn8Y06icwkO1bpddlLC7BmNSHJVhUalzY,1818
17
17
  libretificacaotjcore/services/rabbitmq_publisher.py,sha256=xsb9LmIuZizzq5lxnEEZKMK3U952KSQ2oqlTBZi2Lt8,1787
18
18
  libretificacaotjcore/services/request_servico_api.py,sha256=G7vnmvOfwrCGL-Jy_5tCKG-l5E00OCkJfkuoa5Y6sHo,613
19
19
  libretificacaotjcore/services/s3_service.py,sha256=HKR_jt2H3XdV1PCzo5R5bnhmoQ3I46Yn5IqAvVPhsjs,2946
20
- libretificacaotjcore-0.1.39.dist-info/METADATA,sha256=DkNnpyxrvUU7Co7tsQGd149VPHS9sv3M3C3UtOckiHE,2564
21
- libretificacaotjcore-0.1.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- libretificacaotjcore-0.1.39.dist-info/top_level.txt,sha256=J9vnz_X9OUnxC-eXHiAzlc9xIrWBwZ5bgnIDQIIFY4c,21
23
- libretificacaotjcore-0.1.39.dist-info/RECORD,,
20
+ libretificacaotjcore-0.1.41.dist-info/METADATA,sha256=0x-eR87qqi8JNNIBIY5eTCbMLNlk6FRtOYCXZiVQ7sI,2564
21
+ libretificacaotjcore-0.1.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ libretificacaotjcore-0.1.41.dist-info/top_level.txt,sha256=J9vnz_X9OUnxC-eXHiAzlc9xIrWBwZ5bgnIDQIIFY4c,21
23
+ libretificacaotjcore-0.1.41.dist-info/RECORD,,