Skip to content

fix(notification): disable mail health contributor in DlqIntegrationTest#31

Merged
dancodingbr merged 4 commits into
mainfrom
feat/notification-dlq
Apr 27, 2026
Merged

fix(notification): disable mail health contributor in DlqIntegrationTest#31
dancodingbr merged 4 commits into
mainfrom
feat/notification-dlq

Conversation

@dancodingbr
Copy link
Copy Markdown
Owner

@MockitoBean replaces JavaMailSenderImpl with a mock; MailHealthContributorAutoConfiguration requires a concrete implementation and fails with 'beans must not be empty' on CI. Disabling the mail health check in this test context fixes the context startup failure.

@MockitoBean replaces JavaMailSenderImpl with a mock; MailHealthContributorAutoConfiguration
requires a concrete implementation and fails with 'beans must not be empty' on CI.
Disabling the mail health check in this test context fixes the context startup failure.
…olling queue

DeadLetterConsumer actively acks messages from the DLQ so rabbitTemplate.receive()
always returns null. Use @MockitoSpyBean to verify the consumer was called instead.
…tegration test

@MockitoSpyBean cannot intercept @RabbitListener calls because Spring AMQP
captures the original bean reference before the spy wrapper is applied.
Assign a stable ID to the DLQ listener and stop it via the registry before
the test so messages remain in the queue for direct polling.
The test classpath application.yaml replaces the production one, losing
retry.enabled=true. Without retry the listener nacks with requeue=true and
RabbitMQ redelivers the message forever instead of routing to the DLQ.

Adding retry.enabled=true to @DynamicPropertySource activates Spring AMQP's
in-memory retry interceptor, which rejects with requeue=false after max-attempts
and triggers dead-letter routing.
@dancodingbr dancodingbr merged commit 6df5ff6 into main Apr 27, 2026
9 checks passed
@dancodingbr dancodingbr deleted the feat/notification-dlq branch April 27, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant