Skip to content

ARTEMIS-3164 Support prefix to create temporary resources - #6591

Open
anmol-saxena-14 wants to merge 1 commit into
apache:mainfrom
anmol-saxena-14:ARTEMIS-3164
Open

ARTEMIS-3164 Support prefix to create temporary resources#6591
anmol-saxena-14 wants to merge 1 commit into
apache:mainfrom
anmol-saxena-14:ARTEMIS-3164

Conversation

@anmol-saxena-14

@anmol-saxena-14 anmol-saxena-14 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

The broker already lets anycastPrefix/multicastPrefix control routing type for auto-created addresses and queues. This PR adds the same idea for lifecycle: temporaryAnycastPrefix/temporaryMulticastPrefix mark a matching address/queue as temporary, so it's deleted automatically when the connection that created it disconnects.

tcp://0.0.0.0:61616?protocols=STOMP;temporaryAnycastPrefix=/temp-queue/;temporaryMulticastPrefix=/temp-topic/

It's a core session feature (ServerSession), not STOMP-specific, so Core, AMQP, OpenWire, MQTT and STOMP all get it the same way. The motivating case is STOMP clients moving off ActiveMQ 5.x's hard-coded /temp-queue//temp-topic/ prefixes, but any protocol can use it.

Along the way this also fixes STOMP losing the temporary signal by stripping the prefix too early, and a disconnect-cleanup bug that could leave orphaned temporary addresses behind.

Covered by two new tests (TemporaryPrefixTest, StompTemporaryPrefixTest) plus regression across StompTest/StompV12Test, CoreClientTest, AmqpDurableReceiverReconnectWithMulticastPrefixTest, ServerSessionImplTest, HangConsumerTest and OrphanedConsumerDefenseTest.

@anmol-saxena-14
anmol-saxena-14 marked this pull request as ready for review July 21, 2026 16:57
@anmol-saxena-14

Copy link
Copy Markdown
Contributor Author

Link to earlier PR which got closed : #6378

@anmol-saxena-14

Copy link
Copy Markdown
Contributor Author

@jbertram Can you please review this. This address the review comment mentioned on earlier PR which got closed : #6378

Thanks

@jbertram

jbertram commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

There's a few issue with this PR at the moment:

  • This PR is not mainly about moving this setting "out of STOMP-only code and into the core session." It's mainly about the full implementation of and testing for a "temporary prefix" in general.
  • All the commits should be squashed since they overlap so much.
  • There are conflicts which need to be resolved.

@anmol-saxena-14 anmol-saxena-14 changed the title ARTEMIS-3164 Move temporary prefix support from STOMP into the core session ARTEMIS-3164 Support prefix to create temporary resources Sep 8, 2026
Add temporaryAnycastPrefix/temporaryMulticastPrefix, mirroring the
existing anycastPrefix/multicastPrefix. Implemented at the core
session level so it works for all protocols (Core, AMQP, OpenWire,
MQTT, STOMP), not just STOMP.

Also fixes STOMP stripping the temp prefix before checking it, and
a cleanup bug where prefixed temporary addresses weren't deleted on
disconnect.

Tested with new TemporaryPrefixTest and StompTemporaryPrefixTest,
plus full StompTest/StompV12Test, CoreClientTest,
AmqpDurableReceiverReconnectWithMulticastPrefixTest,
ServerSessionImplTest, HangConsumerTest, OrphanedConsumerDefenseTest.
@anmol-saxena-14

Copy link
Copy Markdown
Contributor Author

Adds temporaryAnycastPrefix/temporaryMulticastPrefix, matching how anycastPrefix/multicastPrefix already work. Any address/queue created under one of these prefixes is marked temporary and cleaned up when the connection closes.

Implemented at the core session level, so it works for every protocol (Core, AMQP, OpenWire, MQTT, STOMP) instead of being STOMP-only. Main use case is STOMP clients migrating from ActiveMQ 5.x's hard-coded /temp-queue/ and /temp-topic/ prefixes.

Example:
tcp://0.0.0.0:61616?protocols=STOMP;temporaryAnycastPrefix=/temp-queue/;temporaryMulticastPrefix=/temp-topic/

Also fixes two bugs:

  • STOMP was stripping the prefix before checking it, so the temporary signal never reached the core session.
  • Prefixed temporary addresses could be left behind after disconnect since they weren't flagged temporary early enough to be cleaned up.

Verified with: TemporaryPrefixTest(new), StompTemporaryPrefixTest(new), full StompTest/StompV12Test, CoreClientTest, AmqpDurableReceiverReconnectWithMulticastPrefixTest, ServerSessionImplTest, HangConsumerTest, OrphanedConsumerDefenseTest

@anmol-saxena-14

Copy link
Copy Markdown
Contributor Author

@jbertram I have addressed the PR review comment, Please review. Thanks

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.

2 participants