jarvis-ai-framework 1.0.0
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.
- package/AGENTS.md +416 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/agents/AGENTS.md +234 -0
- package/agents/README.md +309 -0
- package/agents/engineering/data/eng.data-engineer.agent.md +309 -0
- package/agents/engineering/eng.agent.md +303 -0
- package/agents/engineering/eng.bug-hunter.md +386 -0
- package/agents/engineering/eng.cybersecurity.agent.md +503 -0
- package/agents/engineering/eng.dev-code-reviewer.md +148 -0
- package/agents/engineering/eng.docs-writer.md +152 -0
- package/agents/engineering/eng.frontend.agent.md +117 -0
- package/agents/engineering/eng.rpa.agent.md +215 -0
- package/agents/engineering/eng.tech-analyst.agent.md +102 -0
- package/agents/engineering/eng.ux-designer.agent.md +193 -0
- package/agents/engineering/qa/eng.qa.cypress-specialist.md +109 -0
- package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +85 -0
- package/agents/engineering/qa/eng.qa.quality-strategist.md +111 -0
- package/agents/engineering/qa/eng.qa.test-architect.md +400 -0
- package/agents/engineering/qa/eng.qa.test-planner.md +477 -0
- package/agents/engineering/qa/eng.qa.testing-engineer.md +339 -0
- package/agents/product/prod.pm-checker.md +52 -0
- package/bin/commands/docs-publish.js +184 -0
- package/bin/commands/docs-sync.js +139 -0
- package/bin/commands/info.js +87 -0
- package/bin/commands/init.js +237 -0
- package/bin/commands/install-rtk.js +90 -0
- package/bin/commands/list.js +48 -0
- package/bin/commands/qa-signoff.js +112 -0
- package/bin/commands/whoami.js +43 -0
- package/bin/jarvis.js +159 -0
- package/bin/lib/auth/session.js +56 -0
- package/bin/lib/config/constants.js +123 -0
- package/bin/lib/config/ide-config.js +233 -0
- package/bin/lib/core/scanner.js +124 -0
- package/bin/lib/core/sync-engine.js +551 -0
- package/bin/lib/docs/fetch-file.sh +41 -0
- package/bin/lib/docs/publish-file.sh +284 -0
- package/bin/lib/docs/validate-frontmatter.js +157 -0
- package/bin/lib/env-loader.js +198 -0
- package/bin/lib/tasks/comment.js +131 -0
- package/bin/lib/utils/git-parser.js +145 -0
- package/bin/lib/utils/logger.js +104 -0
- package/bin/lib/utils/npmrc-parser.js +106 -0
- package/bin/lib/utils/paths.js +55 -0
- package/bin/lib/utils/ui.js +59 -0
- package/bin/lib/vcs/api.js +312 -0
- package/bin/lib/vcs/create-issue.js +43 -0
- package/bin/lib/vcs/create-merge.js +43 -0
- package/bin/lib/vcs/fetch-raw.js +30 -0
- package/bin/postinstall.js +41 -0
- package/members.md +25 -0
- package/package.json +55 -0
- package/rules/AGENTS.md +205 -0
- package/rules/engineering/data/data-rules.md +200 -0
- package/rules/engineering/eng-rules.md +243 -0
- package/rules/engineering/eng-security-rules.md +186 -0
- package/rules/engineering/eng.breakdown-subtasks-rules.md +585 -0
- package/rules/engineering/eng.bump-rules.md +27 -0
- package/rules/engineering/eng.docs-scraping-rules.md +64 -0
- package/rules/engineering/eng.downstream-flow-rules.md +297 -0
- package/rules/engineering/eng.integrations-rules.md +73 -0
- package/rules/engineering/eng.plan-rules.md +333 -0
- package/rules/engineering/eng.pr-rules.md +359 -0
- package/rules/engineering/eng.pre-pr-rules.md +103 -0
- package/rules/engineering/eng.start-rules.md +246 -0
- package/rules/engineering/eng.tech-spec-rules.md +968 -0
- package/rules/engineering/eng.work-rules.md +312 -0
- package/rules/engineering/frontend/eng.frontend-rules.md +147 -0
- package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
- package/rules/engineering/qa/eng.qa.exploratory-session-rules.md +137 -0
- package/rules/engineering/qa/eng.qa.quality-gate-scoring-rules.md +181 -0
- package/rules/engineering/qa/eng.qa.tech-spec-validation-criteria-rules.md +120 -0
- package/rules/engineering/rpa/eng.rpa-rules.md +230 -0
- package/rules/product/README.md +24 -0
- package/rules/product/prod-rules.md +151 -0
- package/rules/rtk-rules.md +68 -0
- package/skills/AGENTS.md +290 -0
- package/skills/SKILLS-ROADMAP.md +333 -0
- package/skills/churn-audit/SKILL.md +385 -0
- package/skills/context-detect/SKILL.md +399 -0
- package/skills/context-detect/assets/context-profile-template.md +127 -0
- package/skills/docs-central/README.md +310 -0
- package/skills/docs-central/SKILL.md +423 -0
- package/skills/docs-index/SKILL.md +377 -0
- package/skills/eng-ai-engineer/SKILL.md +296 -0
- package/skills/eng-arch-c4/SKILL.md +358 -0
- package/skills/eng-arch-c4/assets/example-code.md +189 -0
- package/skills/eng-arch-c4/assets/example-component.md +105 -0
- package/skills/eng-arch-c4/assets/example-container.md +104 -0
- package/skills/eng-arch-c4/assets/example-context.md +81 -0
- package/skills/eng-backend/SKILL.md +776 -0
- package/skills/eng-browser-extension-builder/SKILL.md +385 -0
- package/skills/eng-cybersecurity/SKILL.md +645 -0
- package/skills/eng-data-bi/SKILL.md +199 -0
- package/skills/eng-data-debug/SKILL.md +307 -0
- package/skills/eng-data-engineer/SKILL.md +256 -0
- package/skills/eng-data-onboard/SKILL.md +310 -0
- package/skills/eng-data-orchestrator/SKILL.md +426 -0
- package/skills/eng-design-system/SKILL.md +619 -0
- package/skills/eng-docs-write/SKILL.md +312 -0
- package/skills/eng-frontend/SKILL.md +913 -0
- package/skills/eng-jira-comment/SKILL.md +17 -0
- package/skills/eng-microfrontend/SKILL.md +602 -0
- package/skills/eng-ms-trace/SKILL.md +469 -0
- package/skills/eng-nestjs/SKILL.md +791 -0
- package/skills/eng-performance-engineer/SKILL.md +312 -0
- package/skills/eng-pr/SKILL.md +339 -0
- package/skills/eng-qa-a11y-audit/SKILL.md +269 -0
- package/skills/eng-qa-bug-report/SKILL.md +1088 -0
- package/skills/eng-qa-bug-report/TASK_MANAGERS.md +138 -0
- package/skills/eng-qa-cypress-e2e/SKILL.md +177 -0
- package/skills/eng-qa-dev-guide/SKILL.md +164 -0
- package/skills/eng-qa-e2e/SKILL.md +400 -0
- package/skills/eng-qa-e2e-spec-writer/SKILL.md +322 -0
- package/skills/eng-qa-exploratory/SKILL.md +188 -0
- package/skills/eng-qa-gate/SKILL.md +370 -0
- package/skills/eng-qa-gate/assets/checklist-validacao.md +291 -0
- package/skills/eng-qa-graphql-contract/SKILL.md +256 -0
- package/skills/eng-qa-quality-report/SKILL.md +412 -0
- package/skills/eng-qa-test-plan/SKILL.md +466 -0
- package/skills/eng-qa-test-plan/assets/test-coverage-template.md +92 -0
- package/skills/eng-qa-test-plan/assets/test-patterns.md +178 -0
- package/skills/eng-qa-testsprite/SKILL.md +325 -0
- package/skills/eng-qa-testsprite/references/testsprite-mcp.md +224 -0
- package/skills/eng-qa-unit-test/SKILL.md +471 -0
- package/skills/eng-rabbitmq/SKILL.md +661 -0
- package/skills/eng-scraper/SKILL.md +683 -0
- package/skills/eng-scraper-robot-builder/SKILL.md +370 -0
- package/skills/eng-security-patch/SKILL.md +378 -0
- package/skills/eng-security-triage/SKILL.md +266 -0
- package/skills/eng-task-comment/SKILL.md +60 -0
- package/skills/eng-tech-analyst/SKILL.md +529 -0
- package/skills/eng-threat-model/SKILL.md +161 -0
- package/skills/init-jarvis/SKILL.md +1304 -0
- package/skills/init-jarvis/assets/mcp-configs.md +389 -0
- package/skills/init-jarvis/assets/onboarding-checklist.md +104 -0
- package/skills/init-jarvis/assets/setup-guide.md +360 -0
- package/skills/lovable-prompt-generator/SKILL.md +304 -0
- package/skills/prod-roadmap-report/README.md +303 -0
- package/skills/prod-roadmap-report/SKILL.md +198 -0
- package/skills/prod-roadmap-report/commands/status.compiled.single.team.md +23 -0
- package/skills/prod-roadmap-report/commands/status.list.projects.md +17 -0
- package/skills/prod-roadmap-report/commands/status.memory.md +192 -0
- package/skills/prod-roadmap-report/commands/status.roadmap.preview.md +94 -0
- package/skills/prod-roadmap-report/references/detailed-guide.md +236 -0
- package/skills/prod-roadmap-report/rules/detailed-guide.md +237 -0
- package/skills/prod-roadmap-report/rules/status-report-rules.md +44 -0
- package/skills/prod-roadmap-report/templates/template-multiple-teams-compiled-status.md +53 -0
- package/skills/prod-roadmap-report/templates/template-projects-list.md +23 -0
- package/skills/prod-roadmap-report/templates/template-single-team-compiled-status.md +60 -0
- package/skills/prod-roadmap-report/templates/template-single-team-status.md +49 -0
- package/skills/prod-specs/SKILL.md +108 -0
- package/skills/prod-specs/references/prod.spec.clarify.md +176 -0
- package/skills/prod-specs/references/prod.spec.epic.md +107 -0
- package/skills/prod-specs/references/prod.spec.frd.md +135 -0
- package/skills/prod-specs/references/prod.spec.issue.md +145 -0
- package/skills/prod-specs/references/prod.spec.prd.md +118 -0
- package/skills/prod-specs/rules/prod-spec-rules.md +186 -0
- package/skills/prod-specs/templates/prod-breakdown-template.md +136 -0
- package/skills/prod-specs/templates/prod-epic-template.md +76 -0
- package/skills/prod-specs/templates/prod-frd-template.md +172 -0
- package/skills/prod-specs/templates/prod-issue-template.md +68 -0
- package/skills/prod-specs/templates/prod-prd-full-template.md +159 -0
- package/skills/prod-specs/templates/prod-prd-template.md +173 -0
- package/skills/prod-specs-update/SKILL.md +272 -0
- package/skills/report-issue/SKILL.md +156 -0
- package/taxonomy.md +270 -0
- package/templates/AGENTS.md +189 -0
- package/templates/CDD aplicado a Prompts.md +182 -0
- package/templates/ENV-template.md +187 -0
- package/templates/engineering/AGENTS-template.md +71 -0
- package/templates/engineering/ARD-template.md +193 -0
- package/templates/engineering/CONTACTS-template.md +135 -0
- package/templates/engineering/PR-template.md +40 -0
- package/templates/engineering/RFC-Playbook.md +325 -0
- package/templates/engineering/RFC-template.md +199 -0
- package/templates/engineering/architecture-template.md +277 -0
- package/templates/engineering/breakdown-subtasks-template.md +582 -0
- package/templates/engineering/c4-model-template.md +516 -0
- package/templates/engineering/data-contract-template.md +135 -0
- package/templates/engineering/data-pipeline-template.md +163 -0
- package/templates/engineering/plan-template.md +255 -0
- package/templates/engineering/qa/eng.qa.quality-gate-examples-template.md +311 -0
- package/templates/engineering/qa/eng.qa.quality-gate-report-template.md +249 -0
- package/templates/engineering/qa/qa.cypress-test-template.md +172 -0
- package/templates/engineering/qa/qa.exploratory-session-template.md +148 -0
- package/templates/engineering/qa/qa.quality-report-template.md +130 -0
- package/templates/engineering/qa/qa.release-signoff-template.md +54 -0
- package/templates/engineering/qa/qa.sprint-plan-template.md +49 -0
- package/templates/engineering/swagger-template.md +145 -0
- package/templates/engineering/tech-spec-template.md +497 -0
- package/templates/engineering/work-progress-template.md +155 -0
- package/workflows/AGENTS.md +240 -0
- package/workflows/README.md +160 -0
- package/workflows/all-tools.md +11 -0
- package/workflows/engineering/data/data.contract.md +202 -0
- package/workflows/engineering/data/data.new-pipeline.md +234 -0
- package/workflows/engineering/eng.breakdown-subtasks.md +420 -0
- package/workflows/engineering/eng.bug-audit.md +591 -0
- package/workflows/engineering/eng.build-tech-spec.md +1116 -0
- package/workflows/engineering/eng.create-ard-from-code.md +259 -0
- package/workflows/engineering/eng.create-ard.md +382 -0
- package/workflows/engineering/eng.create-rfc.md +245 -0
- package/workflows/engineering/eng.debug.md +479 -0
- package/workflows/engineering/eng.docs.md +40 -0
- package/workflows/engineering/eng.light-arch.md +84 -0
- package/workflows/engineering/eng.plan.md +213 -0
- package/workflows/engineering/eng.pr.md +466 -0
- package/workflows/engineering/eng.pre-pr.md +167 -0
- package/workflows/engineering/eng.review.md +185 -0
- package/workflows/engineering/eng.rpa.robot.md +342 -0
- package/workflows/engineering/eng.security-audit.md +312 -0
- package/workflows/engineering/eng.security-incident.md +275 -0
- package/workflows/engineering/eng.security-pipeline.md +210 -0
- package/workflows/engineering/eng.security-review.md +235 -0
- package/workflows/engineering/eng.start.md +494 -0
- package/workflows/engineering/eng.work.md +558 -0
- package/workflows/engineering/frontend/eng.frontend-component.md +190 -0
- package/workflows/engineering/frontend/eng.frontend-perf-audit.md +375 -0
- package/workflows/engineering/frontend/eng.frontend-review.md +185 -0
- package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +51 -0
- package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +51 -0
- package/workflows/engineering/qa/eng.qa-exploratory-session.md +60 -0
- package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +202 -0
- package/workflows/engineering/qa/eng.qa-quality-report.md +83 -0
- package/workflows/engineering/qa/eng.qa-refinement-entry.md +83 -0
- package/workflows/engineering/qa/eng.qa-release-signoff.md +170 -0
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +100 -0
- package/workflows/engineering/ta/eng.ta.atendimento.md +93 -0
- package/workflows/product/prod.roadmap.preview.md +110 -0
- package/workflows/product/prod.spec.breakdown.md +163 -0
- package/workflows/product/prod.spec.clarify.md +178 -0
- package/workflows/product/prod.spec.epic.md +154 -0
- package/workflows/product/prod.spec.frd.md +96 -0
- package/workflows/product/prod.spec.issue.md +145 -0
- package/workflows/product/prod.spec.md +60 -0
- package/workflows/product/prod.spec.prd.md +100 -0
- package/workflows/taxonomy.md +92 -0
- package/workflows/warm-up.md +574 -0
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eng-rabbitmq
|
|
3
|
+
description: >
|
|
4
|
+
Especialista completo em RabbitMQ: gerenciamento via Management HTTP API, criação de consumers/producers,
|
|
5
|
+
arquitetura de mensageria, resolução de problemas e boas práticas.
|
|
6
|
+
Trigger: Use quando falar de eventos, filas, orquestramento de filas, mensageria, consumers, producers,
|
|
7
|
+
dead letter, retry, fanout, routing, troubleshooting ou qualquer coisa sobre RabbitMQ.
|
|
8
|
+
license: AGPL-3.0
|
|
9
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
10
|
+
allowed-tools: Read Bash WebFetch
|
|
11
|
+
metadata:
|
|
12
|
+
author: jarvis-team
|
|
13
|
+
version: "2.0"
|
|
14
|
+
argument-hint: "[operação|criar|problema] [contexto]"
|
|
15
|
+
disable-model-invocation: false
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Eng RabbitMQ - Especialista Completo em Mensageria
|
|
19
|
+
|
|
20
|
+
Você é um **especialista completo em RabbitMQ** com domínio em gerenciamento via Management HTTP API, criação de código para consumers/producers, arquitetura de mensageria, resolução de problemas e boas práticas de produção.
|
|
21
|
+
|
|
22
|
+
## Objetivo
|
|
23
|
+
|
|
24
|
+
Ser o ponto único de referência para tudo sobre RabbitMQ no projeto:
|
|
25
|
+
- **Gerenciar** exchanges, filas, bindings e mensagens via Management HTTP API
|
|
26
|
+
- **Criar** código de consumers e producers em qualquer linguagem/framework
|
|
27
|
+
- **Arquitetar** topologias de mensageria (DLX, retry, fanout, topic, headers)
|
|
28
|
+
- **Resolver** problemas, erros e comportamentos inesperados
|
|
29
|
+
- **Orientar** sobre padrões, boas práticas e configurações de produção
|
|
30
|
+
|
|
31
|
+
## Entrada
|
|
32
|
+
|
|
33
|
+
- `$ARGUMENTS` - Operação, problema ou intenção (ex: `criar-consumer`, `debug-fila-travada`, `arquitetura-retry`, `criar-fila`, `publicar`, `consumir`)
|
|
34
|
+
|
|
35
|
+
## Recursos
|
|
36
|
+
|
|
37
|
+
- **API Base**: `$MESSAGE_BROKER_URL_API` (lido do ENV.md)
|
|
38
|
+
- **ENV**: `$IDE/ENV.md` (variáveis de ambiente do projeto)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Pré-requisito
|
|
43
|
+
|
|
44
|
+
Verificar se o `ENV.md` existe e se as credenciais do message broker estão disponíveis:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
grep "MESSAGE_BROKER" $IDE/ENV.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Variáveis obrigatórias:**
|
|
51
|
+
|
|
52
|
+
| Variável | Valor esperado |
|
|
53
|
+
|----------|---------------|
|
|
54
|
+
| `MESSAGE_BROKER` | `RABBITMQ` (ou outro broker) |
|
|
55
|
+
| `MESSAGE_BROKER_URL_API` | URL base da Management HTTP API |
|
|
56
|
+
| `MESSAGE_BROKER_API_AUTH` | Credenciais no formato `usuario:senha` |
|
|
57
|
+
|
|
58
|
+
**Extraindo credenciais do `MESSAGE_BROKER_API_AUTH`:**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
AUTH=$(grep "MESSAGE_BROKER_API_AUTH" $IDE/ENV.md | cut -d'=' -f2)
|
|
62
|
+
MB_URL=$(grep "MESSAGE_BROKER_URL_API" $IDE/ENV.md | cut -d'=' -f2)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> **Nota**: Se as variáveis não estiverem no ENV.md, solicitar ao usuário antes de prosseguir.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Quando Usar
|
|
70
|
+
|
|
71
|
+
Use este skill quando:
|
|
72
|
+
- Precisar criar ou gerenciar exchanges, filas e bindings
|
|
73
|
+
- Precisar publicar mensagens em exchanges ou filas
|
|
74
|
+
- Precisar consumir/inspecionar mensagens de uma fila
|
|
75
|
+
- Precisar listar ou monitorar filas, connections e channels
|
|
76
|
+
- Precisar configurar permissões ou virtual hosts
|
|
77
|
+
- Falar sobre eventos, orquestramento de filas ou mensageria
|
|
78
|
+
- Precisar criar código de consumer ou producer (Node.js, Python, etc.)
|
|
79
|
+
- Precisar projetar ou revisar uma arquitetura de mensageria
|
|
80
|
+
- Precisar resolver um problema ou comportamento inesperado no RabbitMQ
|
|
81
|
+
- Precisar entender padrões como DLX, retry com delay, fanout, topic routing
|
|
82
|
+
|
|
83
|
+
**NÃO usar quando:**
|
|
84
|
+
- A tarefa não envolve RabbitMQ ou mensageria
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Padrões Críticos
|
|
89
|
+
|
|
90
|
+
### Padrão 1: Autenticação sempre via Basic Auth
|
|
91
|
+
|
|
92
|
+
Todas as chamadas usam HTTP Basic Auth. Nunca expor credenciais em logs.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Extrair variáveis do ENV.md
|
|
96
|
+
AUTH=$(grep "MESSAGE_BROKER_API_AUTH" $IDE/ENV.md | cut -d'=' -f2)
|
|
97
|
+
MB_URL=$(grep "MESSAGE_BROKER_URL_API" $IDE/ENV.md | cut -d'=' -f2)
|
|
98
|
+
VHOST="%2F" # "/" codificado como "%2F"
|
|
99
|
+
|
|
100
|
+
# AUTH já está no formato "usuario:senha" — usar diretamente com -u
|
|
101
|
+
curl -s -u "$AUTH" "$MB_URL/overview"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Padrão 2: Virtual host "/" deve ser codificado como "%2F"
|
|
105
|
+
|
|
106
|
+
O vhost padrão `/` SEMPRE deve ser codificado como `%2F` nas URLs.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# CORRETO
|
|
110
|
+
curl -u "$AUTH" "$MB_URL/queues/%2F/minha-fila"
|
|
111
|
+
|
|
112
|
+
# ERRADO
|
|
113
|
+
curl -u "$AUTH" "$MB_URL/queues///minha-fila"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Padrão 3: Exchanges devem ser criadas antes de filas e bindings
|
|
117
|
+
|
|
118
|
+
Ordem obrigatória: Exchange → Fila → Binding
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# 1. Criar exchange
|
|
122
|
+
curl -s -X PUT -u "$AUTH" \
|
|
123
|
+
-H "Content-Type: application/json" \
|
|
124
|
+
-d '{"type":"direct","durable":true}' \
|
|
125
|
+
"$MB_URL/exchanges/%2F/minha-exchange"
|
|
126
|
+
|
|
127
|
+
# 2. Criar fila
|
|
128
|
+
curl -s -X PUT -u "$AUTH" \
|
|
129
|
+
-H "Content-Type: application/json" \
|
|
130
|
+
-d '{"durable":true}' \
|
|
131
|
+
"$MB_URL/queues/%2F/minha-fila"
|
|
132
|
+
|
|
133
|
+
# 3. Criar binding
|
|
134
|
+
curl -s -X POST -u "$AUTH" \
|
|
135
|
+
-H "Content-Type: application/json" \
|
|
136
|
+
-d '{"routing_key":"minha-routing-key"}' \
|
|
137
|
+
"$MB_URL/bindings/%2F/e/minha-exchange/q/minha-fila"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Padrão 4: Payload de mensagem deve ser codificado corretamente
|
|
141
|
+
|
|
142
|
+
O campo `payload` deve estar em string. Usar `payload_encoding: "string"` para texto simples ou `"base64"` para binários.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Publicar mensagem JSON
|
|
146
|
+
curl -s -X POST -u "$USER:$PASS" \
|
|
147
|
+
-H "Content-Type: application/json" \
|
|
148
|
+
-d '{
|
|
149
|
+
"properties": {"content_type": "application/json", "delivery_mode": 2},
|
|
150
|
+
"routing_key": "minha-routing-key",
|
|
151
|
+
"payload": "{\"evento\":\"criado\",\"id\":123}",
|
|
152
|
+
"payload_encoding": "string"
|
|
153
|
+
}' \
|
|
154
|
+
"$URL/exchanges/%2F/minha-exchange/publish"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Árvore de Decisão
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
Precisa criar infraestrutura? → Fluxo: Configurar Exchange + Fila + Binding
|
|
163
|
+
Precisa publicar mensagem? → Fluxo: Publicar via exchange
|
|
164
|
+
Precisa ler/inspecionar mensagem? → Fluxo: Consumir da fila
|
|
165
|
+
Precisa monitorar o estado? → GET /overview, /queues, /connections
|
|
166
|
+
Precisa limpar fila? → DELETE /queues/{vhost}/{name}/contents
|
|
167
|
+
Precisa criar código consumer? → Seção: Criar Código de Consumer/Producer
|
|
168
|
+
Precisa criar código producer? → Seção: Criar Código de Consumer/Producer
|
|
169
|
+
Precisa projetar retry/DLX/fanout? → Seção: Arquiteturas Comuns
|
|
170
|
+
Tem um problema ou comportamento? → Seção: Troubleshooting
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Fluxo de Trabalho
|
|
176
|
+
|
|
177
|
+
### 1. Verificar Conectividade
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
AUTH=$(grep "MESSAGE_BROKER_API_AUTH" $IDE/ENV.md | cut -d'=' -f2)
|
|
181
|
+
MB_URL=$(grep "MESSAGE_BROKER_URL_API" $IDE/ENV.md | cut -d'=' -f2)
|
|
182
|
+
|
|
183
|
+
curl -s -u "$AUTH" "$MB_URL/overview" | python3 -m json.tool
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 2. Listar Recursos Existentes
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Listar todas as filas
|
|
190
|
+
curl -s -u "$AUTH" "$MB_URL/queues" | python3 -m json.tool
|
|
191
|
+
|
|
192
|
+
# Listar exchanges
|
|
193
|
+
curl -s -u "$AUTH" "$MB_URL/exchanges/%2F" | python3 -m json.tool
|
|
194
|
+
|
|
195
|
+
# Listar bindings
|
|
196
|
+
curl -s -u "$AUTH" "$MB_URL/bindings/%2F" | python3 -m json.tool
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 3. Criar Exchange
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Tipos disponíveis: direct, fanout, topic, headers
|
|
203
|
+
curl -s -X PUT -u "$AUTH" \
|
|
204
|
+
-H "Content-Type: application/json" \
|
|
205
|
+
-d '{
|
|
206
|
+
"type": "direct",
|
|
207
|
+
"durable": true,
|
|
208
|
+
"auto_delete": false,
|
|
209
|
+
"internal": false,
|
|
210
|
+
"arguments": {}
|
|
211
|
+
}' \
|
|
212
|
+
"$MB_URL/exchanges/%2F/{nome-exchange}"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 4. Criar Fila
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
curl -s -X PUT -u "$AUTH" \
|
|
219
|
+
-H "Content-Type: application/json" \
|
|
220
|
+
-d '{
|
|
221
|
+
"durable": true,
|
|
222
|
+
"auto_delete": false,
|
|
223
|
+
"arguments": {
|
|
224
|
+
"x-message-ttl": 86400000,
|
|
225
|
+
"x-dead-letter-exchange": "{nome-dlx}"
|
|
226
|
+
}
|
|
227
|
+
}' \
|
|
228
|
+
"$MB_URL/queues/%2F/{nome-fila}"
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 5. Criar Binding (Exchange → Fila)
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
curl -s -X POST -u "$AUTH" \
|
|
235
|
+
-H "Content-Type: application/json" \
|
|
236
|
+
-d '{
|
|
237
|
+
"routing_key": "{routing-key}",
|
|
238
|
+
"arguments": {}
|
|
239
|
+
}' \
|
|
240
|
+
"$MB_URL/bindings/%2F/e/{nome-exchange}/q/{nome-fila}"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 6. Publicar Mensagem
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
curl -s -X POST -u "$AUTH" \
|
|
247
|
+
-H "Content-Type: application/json" \
|
|
248
|
+
-d '{
|
|
249
|
+
"properties": {
|
|
250
|
+
"content_type": "application/json",
|
|
251
|
+
"delivery_mode": 2
|
|
252
|
+
},
|
|
253
|
+
"routing_key": "{routing-key}",
|
|
254
|
+
"payload": "{\"evento\":\"nome\",\"dados\":{}}",
|
|
255
|
+
"payload_encoding": "string"
|
|
256
|
+
}' \
|
|
257
|
+
"$MB_URL/exchanges/%2F/{nome-exchange}/publish"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 7. Consumir/Inspecionar Mensagens
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Ackmode: ack_requeue_true (peek), ack_requeue_false (consume)
|
|
264
|
+
curl -s -X POST -u "$AUTH" \
|
|
265
|
+
-H "Content-Type: application/json" \
|
|
266
|
+
-d '{
|
|
267
|
+
"count": 5,
|
|
268
|
+
"ackmode": "ack_requeue_true",
|
|
269
|
+
"encoding": "auto",
|
|
270
|
+
"truncate": 50000
|
|
271
|
+
}' \
|
|
272
|
+
"$MB_URL/queues/%2F/{nome-fila}/get"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### 8. Purgar Fila
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
curl -s -X DELETE -u "$AUTH" \
|
|
279
|
+
"$MB_URL/queues/%2F/{nome-fila}/contents"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Referência de Endpoints
|
|
285
|
+
|
|
286
|
+
| Operação | Método | Endpoint |
|
|
287
|
+
|----------|--------|----------|
|
|
288
|
+
| Status geral | GET | `/api/overview` |
|
|
289
|
+
| Listar filas | GET | `/api/queues` |
|
|
290
|
+
| Detalhes de fila | GET | `/api/queues/{vhost}/{name}` |
|
|
291
|
+
| Criar fila | PUT | `/api/queues/{vhost}/{name}` |
|
|
292
|
+
| Deletar fila | DELETE | `/api/queues/{vhost}/{name}` |
|
|
293
|
+
| Purgar fila | DELETE | `/api/queues/{vhost}/{name}/contents` |
|
|
294
|
+
| Consumir mensagens | POST | `/api/queues/{vhost}/{name}/get` |
|
|
295
|
+
| Listar exchanges | GET | `/api/exchanges/{vhost}` |
|
|
296
|
+
| Criar exchange | PUT | `/api/exchanges/{vhost}/{name}` |
|
|
297
|
+
| Deletar exchange | DELETE | `/api/exchanges/{vhost}/{name}` |
|
|
298
|
+
| Publicar mensagem | POST | `/api/exchanges/{vhost}/{name}/publish` |
|
|
299
|
+
| Listar bindings | GET | `/api/bindings/{vhost}` |
|
|
300
|
+
| Criar binding (fila) | POST | `/api/bindings/{vhost}/e/{exchange}/q/{queue}` |
|
|
301
|
+
| Deletar binding | DELETE | `/api/bindings/{vhost}/e/{exchange}/q/{queue}/{props}` |
|
|
302
|
+
| Listar connections | GET | `/api/connections` |
|
|
303
|
+
| Fechar connection | DELETE | `/api/connections/{name}` |
|
|
304
|
+
| Listar channels | GET | `/api/channels` |
|
|
305
|
+
| Listar vhosts | GET | `/api/vhosts` |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Regras
|
|
310
|
+
|
|
311
|
+
### Nunca
|
|
312
|
+
- Expor credenciais (usuário/senha) em logs ou outputs
|
|
313
|
+
- Deletar filas/exchanges sem confirmar com o usuário antes
|
|
314
|
+
- Usar `ackmode: "ack_requeue_false"` sem intenção de consumir permanentemente
|
|
315
|
+
- Criar filas sem `"durable": true` em ambiente de produção
|
|
316
|
+
- Esquecer de codificar o vhost `/` como `%2F`
|
|
317
|
+
|
|
318
|
+
### Sempre
|
|
319
|
+
- Verificar conectividade antes de qualquer operação
|
|
320
|
+
- Usar `delivery_mode: 2` (persistente) em mensagens de produção
|
|
321
|
+
- Confirmar operações destrutivas (delete, purge) com o usuário
|
|
322
|
+
- Listar recursos existentes antes de criar novos (evitar duplicatas)
|
|
323
|
+
- Incluir Dead Letter Exchange (DLX) em filas de produção
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Criar Código de Consumer/Producer
|
|
328
|
+
|
|
329
|
+
Quando o usuário pedir para criar código, gerar implementação completa e funcional. Verificar a linguagem/framework do projeto antes de escolher a biblioteca.
|
|
330
|
+
|
|
331
|
+
### Node.js com amqplib
|
|
332
|
+
|
|
333
|
+
```javascript
|
|
334
|
+
// consumer.js
|
|
335
|
+
const amqp = require('amqplib');
|
|
336
|
+
|
|
337
|
+
async function startConsumer() {
|
|
338
|
+
const conn = await amqp.connect(process.env.RABBITMQ_URL);
|
|
339
|
+
const channel = await conn.createChannel();
|
|
340
|
+
|
|
341
|
+
const queue = 'nome-da-fila';
|
|
342
|
+
await channel.assertQueue(queue, { durable: true });
|
|
343
|
+
channel.prefetch(1); // processa 1 mensagem por vez
|
|
344
|
+
|
|
345
|
+
console.log(`Aguardando mensagens em ${queue}`);
|
|
346
|
+
|
|
347
|
+
channel.consume(queue, async (msg) => {
|
|
348
|
+
if (!msg) return;
|
|
349
|
+
try {
|
|
350
|
+
const payload = JSON.parse(msg.content.toString());
|
|
351
|
+
console.log('Mensagem recebida:', payload);
|
|
352
|
+
|
|
353
|
+
// processar aqui...
|
|
354
|
+
|
|
355
|
+
channel.ack(msg); // confirmar processamento
|
|
356
|
+
} catch (err) {
|
|
357
|
+
console.error('Erro ao processar:', err);
|
|
358
|
+
channel.nack(msg, false, false); // rejeitar sem requeue → vai para DLX
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
startConsumer().catch(console.error);
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
// producer.js
|
|
368
|
+
const amqp = require('amqplib');
|
|
369
|
+
|
|
370
|
+
async function publish(exchange, routingKey, payload) {
|
|
371
|
+
const conn = await amqp.connect(process.env.RABBITMQ_URL);
|
|
372
|
+
const channel = await conn.createChannel();
|
|
373
|
+
|
|
374
|
+
channel.publish(
|
|
375
|
+
exchange,
|
|
376
|
+
routingKey,
|
|
377
|
+
Buffer.from(JSON.stringify(payload)),
|
|
378
|
+
{ persistent: true, contentType: 'application/json' }
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
await channel.close();
|
|
382
|
+
await conn.close();
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Python com pika
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
# consumer.py
|
|
390
|
+
import pika, json, os
|
|
391
|
+
|
|
392
|
+
def on_message(channel, method, properties, body):
|
|
393
|
+
try:
|
|
394
|
+
payload = json.loads(body)
|
|
395
|
+
print(f"Mensagem recebida: {payload}")
|
|
396
|
+
# processar aqui...
|
|
397
|
+
channel.basic_ack(delivery_tag=method.delivery_tag)
|
|
398
|
+
except Exception as e:
|
|
399
|
+
print(f"Erro: {e}")
|
|
400
|
+
channel.basic_nack(delivery_tag=method.delivery_tag, requeue=False)
|
|
401
|
+
|
|
402
|
+
params = pika.URLParameters(os.environ['RABBITMQ_URL'])
|
|
403
|
+
conn = pika.BlockingConnection(params)
|
|
404
|
+
ch = conn.channel()
|
|
405
|
+
ch.basic_qos(prefetch_count=1)
|
|
406
|
+
ch.basic_consume('nome-da-fila', on_message)
|
|
407
|
+
ch.start_consuming()
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
> Sempre ler o projeto para detectar a linguagem e adaptar o código antes de gerar.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Arquiteturas Comuns
|
|
415
|
+
|
|
416
|
+
### Dead Letter Exchange (DLX) — Fila com rejeição controlada
|
|
417
|
+
|
|
418
|
+
```
|
|
419
|
+
Fila principal → (nack/expired) → DLX Exchange → Fila de Dead Letters
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# 1. Criar DLX exchange
|
|
424
|
+
curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
|
|
425
|
+
-d '{"type":"direct","durable":true}' \
|
|
426
|
+
"$MB_URL/exchanges/%2F/dlx.minha-fila"
|
|
427
|
+
|
|
428
|
+
# 2. Criar fila de dead letters
|
|
429
|
+
curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
|
|
430
|
+
-d '{"durable":true}' \
|
|
431
|
+
"$MB_URL/queues/%2F/minha-fila.dead"
|
|
432
|
+
|
|
433
|
+
# 3. Criar binding DLX → fila dead
|
|
434
|
+
curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
|
|
435
|
+
-d '{"routing_key":"minha-fila"}' \
|
|
436
|
+
"$MB_URL/bindings/%2F/e/dlx.minha-fila/q/minha-fila.dead"
|
|
437
|
+
|
|
438
|
+
# 4. Criar fila principal apontando para DLX
|
|
439
|
+
curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
|
|
440
|
+
-d '{
|
|
441
|
+
"durable": true,
|
|
442
|
+
"arguments": {
|
|
443
|
+
"x-dead-letter-exchange": "dlx.minha-fila",
|
|
444
|
+
"x-dead-letter-routing-key": "minha-fila",
|
|
445
|
+
"x-message-ttl": 86400000
|
|
446
|
+
}
|
|
447
|
+
}' \
|
|
448
|
+
"$MB_URL/queues/%2F/minha-fila"
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Retry com Delay (usando TTL + DLX como fila de espera)
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
Fila principal → (nack) → DLX Exchange → Fila retry (TTL 30s) → republica → Fila principal
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# Fila de retry com TTL de 30 segundos e DLX apontando de volta para a fila principal
|
|
459
|
+
curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
|
|
460
|
+
-d '{
|
|
461
|
+
"durable": true,
|
|
462
|
+
"arguments": {
|
|
463
|
+
"x-message-ttl": 30000,
|
|
464
|
+
"x-dead-letter-exchange": "",
|
|
465
|
+
"x-dead-letter-routing-key": "minha-fila"
|
|
466
|
+
}
|
|
467
|
+
}' \
|
|
468
|
+
"$MB_URL/queues/%2F/minha-fila.retry"
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### Fanout — Broadcast para múltiplas filas
|
|
472
|
+
|
|
473
|
+
```
|
|
474
|
+
Exchange fanout → Fila A
|
|
475
|
+
→ Fila B
|
|
476
|
+
→ Fila C
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
# Exchange fanout (routing_key é ignorada)
|
|
481
|
+
curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
|
|
482
|
+
-d '{"type":"fanout","durable":true}' \
|
|
483
|
+
"$MB_URL/exchanges/%2F/events.broadcast"
|
|
484
|
+
|
|
485
|
+
# Cada fila se liga sem routing_key
|
|
486
|
+
curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
|
|
487
|
+
-d '{"routing_key":""}' \
|
|
488
|
+
"$MB_URL/bindings/%2F/e/events.broadcast/q/servico-a"
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Topic Routing — Roteamento por padrão
|
|
492
|
+
|
|
493
|
+
```
|
|
494
|
+
Exchange topic → "pedido.criado" → fila pedidos
|
|
495
|
+
→ "pedido.*" → fila auditoria
|
|
496
|
+
→ "*.erro" → fila alertas
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
|
|
501
|
+
-d '{"type":"topic","durable":true}' \
|
|
502
|
+
"$MB_URL/exchanges/%2F/events.topic"
|
|
503
|
+
|
|
504
|
+
# Binding com wildcard
|
|
505
|
+
curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
|
|
506
|
+
-d '{"routing_key":"pedido.*"}' \
|
|
507
|
+
"$MB_URL/bindings/%2F/e/events.topic/q/fila-auditoria"
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## Troubleshooting
|
|
513
|
+
|
|
514
|
+
### Diagnóstico inicial — sempre começar aqui
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
AUTH=$(grep "MESSAGE_BROKER_API_AUTH" $IDE/ENV.md | cut -d'=' -f2)
|
|
518
|
+
MB_URL=$(grep "MESSAGE_BROKER_URL_API" $IDE/ENV.md | cut -d'=' -f2)
|
|
519
|
+
|
|
520
|
+
# Visão geral do cluster
|
|
521
|
+
curl -s -u "$AUTH" "$MB_URL/overview" | python3 -m json.tool
|
|
522
|
+
|
|
523
|
+
# Filas com problemas (messages_ready > 0 e consumers = 0)
|
|
524
|
+
curl -s -u "$AUTH" "$MB_URL/queues" | python3 -c "
|
|
525
|
+
import json,sys
|
|
526
|
+
qs = json.load(sys.stdin)
|
|
527
|
+
for q in qs:
|
|
528
|
+
ready = q.get('messages_ready', 0)
|
|
529
|
+
consumers = q.get('consumers', 0)
|
|
530
|
+
if ready > 0 and consumers == 0:
|
|
531
|
+
print(f\"ALERTA: {q['name']} | mensagens={ready} | consumers=0\")
|
|
532
|
+
"
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### Problema: Fila acumulando mensagens (consumer parado)
|
|
536
|
+
|
|
537
|
+
1. Verificar se há consumers ativos na fila:
|
|
538
|
+
```bash
|
|
539
|
+
curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -m json.tool | grep -E "consumers|messages"
|
|
540
|
+
```
|
|
541
|
+
2. Verificar connections abertas:
|
|
542
|
+
```bash
|
|
543
|
+
curl -s -u "$AUTH" "$MB_URL/connections" | python3 -m json.tool
|
|
544
|
+
```
|
|
545
|
+
3. Checar se o consumer está com unacked alto (travado no processamento):
|
|
546
|
+
```bash
|
|
547
|
+
curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -c "
|
|
548
|
+
import json,sys; q=json.load(sys.stdin)
|
|
549
|
+
print('messages_ready:', q.get('messages_ready'))
|
|
550
|
+
print('messages_unacknowledged:', q.get('messages_unacknowledged'))
|
|
551
|
+
print('consumers:', q.get('consumers'))
|
|
552
|
+
"
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Problema: Mensagens indo para Dead Letter inesperadamente
|
|
556
|
+
|
|
557
|
+
Causas comuns:
|
|
558
|
+
- `x-message-ttl` expirando antes do consumer processar → aumentar TTL ou aumentar prefetch
|
|
559
|
+
- Consumer fazendo `nack` com `requeue=false` por erro no código → checar logs do consumer
|
|
560
|
+
- Fila com `x-max-length` atingido → verificar se fila está lotada
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# Ver argumentos da fila (TTL, DLX, max-length)
|
|
564
|
+
curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -c "
|
|
565
|
+
import json,sys; q=json.load(sys.stdin)
|
|
566
|
+
print(json.dumps(q.get('arguments', {}), indent=2))
|
|
567
|
+
"
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### Problema: Consumer recebe mensagem mas não processa (loop infinito)
|
|
571
|
+
|
|
572
|
+
Sintoma: `messages_unacknowledged` cresce, `messages_ready` não zera.
|
|
573
|
+
|
|
574
|
+
Solução: Verificar prefetch — consumer pode estar segurando todas as mensagens:
|
|
575
|
+
```bash
|
|
576
|
+
# Ver detalhes dos channels (prefetch_count)
|
|
577
|
+
curl -s -u "$AUTH" "$MB_URL/channels" | python3 -m json.tool
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Problema: 406 PRECONDITION_FAILED ao criar fila/exchange
|
|
581
|
+
|
|
582
|
+
A fila/exchange já existe com parâmetros diferentes. Verificar parâmetros atuais:
|
|
583
|
+
```bash
|
|
584
|
+
curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -m json.tool
|
|
585
|
+
```
|
|
586
|
+
Se precisar mudar: deletar e recriar (confirmar com o usuário antes).
|
|
587
|
+
|
|
588
|
+
### Problema: Mensagens publicadas mas não chegam na fila
|
|
589
|
+
|
|
590
|
+
Verificar se o binding existe com a routing_key correta:
|
|
591
|
+
```bash
|
|
592
|
+
curl -s -u "$AUTH" "$MB_URL/bindings/%2F" | python3 -c "
|
|
593
|
+
import json,sys
|
|
594
|
+
for b in json.load(sys.stdin):
|
|
595
|
+
if b.get('source') == 'nome-exchange':
|
|
596
|
+
print(b)
|
|
597
|
+
"
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## Tratamento de Erros
|
|
603
|
+
|
|
604
|
+
### 401 Unauthorized
|
|
605
|
+
- Verificar `MESSAGE_BROKER_API_AUTH` no ENV.md (formato `usuario:senha`)
|
|
606
|
+
- Confirmar que as credenciais têm permissão no vhost
|
|
607
|
+
|
|
608
|
+
### 404 Not Found
|
|
609
|
+
- Verificar se exchange ou fila existe com `GET /api/queues/%2F/{nome}`
|
|
610
|
+
- Verificar se o vhost está correto e codificado como `%2F`
|
|
611
|
+
|
|
612
|
+
### 400 Bad Request
|
|
613
|
+
- Verificar campos obrigatórios do payload (tipo, encoding)
|
|
614
|
+
- Verificar se o tipo de exchange é válido: `direct`, `fanout`, `topic`, `headers`
|
|
615
|
+
|
|
616
|
+
### Conflito ao criar recurso (resource already exists)
|
|
617
|
+
- Listar recursos existentes antes de criar
|
|
618
|
+
- Se já existe com parâmetros diferentes, deletar e recriar ou ajustar
|
|
619
|
+
|
|
620
|
+
---
|
|
621
|
+
|
|
622
|
+
## Checklist de Conclusão
|
|
623
|
+
|
|
624
|
+
- [ ] Conectividade verificada via `/api/overview`
|
|
625
|
+
- [ ] Recursos existentes listados antes de criar novos
|
|
626
|
+
- [ ] Vhost `/` codificado como `%2F` em todas as URLs
|
|
627
|
+
- [ ] Exchange criada com `durable: true`
|
|
628
|
+
- [ ] Fila criada com `durable: true`
|
|
629
|
+
- [ ] Binding criado com `routing_key` correto
|
|
630
|
+
- [ ] Mensagens publicadas com `delivery_mode: 2`
|
|
631
|
+
- [ ] Credenciais não expostas em outputs
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
## Output
|
|
636
|
+
|
|
637
|
+
| Artefato | Descrição |
|
|
638
|
+
|----------|-----------|
|
|
639
|
+
| Resposta JSON da API | Confirmação de criação/operação executada |
|
|
640
|
+
| Lista de recursos | Exchanges, filas e bindings do vhost |
|
|
641
|
+
| Mensagens consumidas | Payload das mensagens recuperadas da fila |
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
## Mensagem de Conclusão
|
|
646
|
+
|
|
647
|
+
```
|
|
648
|
+
Operação RabbitMQ concluída!
|
|
649
|
+
|
|
650
|
+
API: {valor de MESSAGE_BROKER_URL_API}
|
|
651
|
+
VHost: /
|
|
652
|
+
Operação: {operação executada}
|
|
653
|
+
|
|
654
|
+
Resultado:
|
|
655
|
+
- Exchange: {nome ou N/A}
|
|
656
|
+
- Fila: {nome ou N/A}
|
|
657
|
+
- Binding: {routing-key ou N/A}
|
|
658
|
+
- Mensagens: {quantidade ou N/A}
|
|
659
|
+
|
|
660
|
+
Próximo passo: Verificar estado com GET /api/queues/%2F/{nome-fila}
|
|
661
|
+
```
|