Skip to content

Feature/amqps support 2233 - #2247

Closed
Gautam-aman wants to merge 5 commits into
microcks:masterfrom
Gautam-aman:feature/amqps-support-2233
Closed

Gautam-aman wants to merge 5 commits into
microcks:masterfrom
Gautam-aman:feature/amqps-support-2233

Conversation

@Gautam-aman

Copy link
Copy Markdown

Summary

This PR improves the AMQP producer used by the async minion by:

  • Supporting explicit amqp:// and amqps:// URIs.
  • Automatically using amqps:// when the configured broker uses port 5671.
  • Allowing the async minion to start even when the AMQP broker is temporarily unavailable.
  • Skipping message publication when no AMQP connection is available instead of failing.
  • Adding unit tests covering AMQP URI construction.

Changes

  • Added buildAmqpUri() to centralize AMQP URI creation.
  • Updated createConnection() to use the generated URI.
  • Made AMQP connection failures during startup non-fatal by logging the error and continuing startup.
  • Added a null guard in publishMessage() to safely skip publishing when no broker connection exists.
  • Added unit tests for:
    • Default amqp:// URI generation
    • Standard port (5672)
    • TLS port (5671)
    • Explicit amqp:// URIs
    • Explicit amqps:// URIs

Testing

  • Ran mvn spotless:apply
  • Verified Spotless checks pass
  • Added unit tests for URI construction

Fixes #2233

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

👋 @Gautam-aman

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@dipak0000812 dipak0000812 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern with making the initial connection failure non-fatal: setAutomaticRecoveryEnabled(true) does not retry an initial newConnection() failure. If the broker is unavailable when the minion starts, amqpConnection remains null, and the new guard in publishMessage() will skip subsequent publishes even after the broker becomes available.

Could we add a retry/reconnect path for the initial connection, or otherwise clarify how the producer is expected to recover in this case?

@dipak0000812 dipak0000812 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if an established AMQP connection is lost while publishMessage() is running? The current guard only checks for null. Could we also handle a closed connection explicitly so a broker interruption doesn't result in an unexpected failure from createChannel()?

@lbroudoux

Copy link
Copy Markdown
Member

Could we add a retry/reconnect path for the initial connection, or otherwise clarify how the producer is expected to recover in this case?

I think it's better not to recover here. If the connection fails, that means that it's either a configuration or a unavailability issue. In both case, it's better to fail early and as we are in a @PostConstruct method to have a direct impact on the minion and have its probe fail.

What happens if an established AMQP connection is lost while publishMessage() is running?

I tend to think that we should keep it simple here: publication fails, probe fails and the minion container restarts until the connection is OK again. It's better to die early and keep recovery simple IMHO. Don't bother with this here.

@lbroudoux

Copy link
Copy Markdown
Member

@Gautam-aman Any follow-up on the previous review? Let us know.

@Gautam-aman

Copy link
Copy Markdown
Author

No i have stopped working on this.

@lbroudoux

Copy link
Copy Markdown
Member

No i have stopped working on this.

Ok noted. Thanks for the quick response. I'll close the PR to let someone pick up the topic again.

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.

async-minion: support amqps:// for Amazon MQ (port 5671) and non-fatal AMQP startup

3 participants