activemq-artemis/docs/migration-guide/_virtual-topics.adoc

59 lines
3.3 KiB
Plaintext
Raw Normal View History

ARTEMIS-4383 migrate user docs to AsciiDoc Markdown, which is currently used for user-facing documentation, is good for a lot of things. However, it's not great for the kind of complex documentation we have and our need to produce both multi-page HTML and single-page PDF output via Maven. Markdown lacks features which would make the documentation easier to read, easier to navigate, and just look better overall. The current tool-chain uses honkit and a tool called Calibre. Honkit is written in TypeScript and is installed via NPM. Calibre is a native tool so it must be installed via an OS-specific package manager. All this complexity makes building, releasing, uploading, etc. a pain. AsciiDoc is relatively simple like Markdown, but it has more features for presentation and navigation not to mention Java-based Maven tooling to generate both HTML and PDF. Migrating will improve both the appearance of the documentation as well as the processes to generate and upload it. This commit contains the following changes: - Convert all the Markdown for the User Manual, Migration Guide, and Hacking guide to AsciiDoc via kramdown [1]. - Update the `artemis-website` build to use AsciiDoctor Maven tooling. - Update `RELEASING.md` with simplified instructions. - Update Hacking Guide with simplified instructions. - Use AsciiDoc link syntax in Artemis Maven doc plugin. - Drop EPUB & MOBI docs for User Manual as well as PDF for the Hacking Guide. All docs will be HTML only except for the User Manual which will have PDF. - Move all docs up out of their respective "en" directory. This was a hold-over from when we had docs in different languages. - Migration & Hacking Guides are now single-page HTML since they are relatively short. - Refactor README.md to simplify and remove redundant content. Benefits of the change: - Much simplified tooling. No more NPM packages or native tools. - Auto-generated table of contents for every chapter. - Auto-generated anchor links for every sub-section. - Overall more appealing presentation. - All docs will use the ActiveMQ favicon. - No more manual line-wrapping! AsciiDoc recommends one sentence per line and paragraphs are separated by a blank line. - AsciiDoctor plugins for IDEA are quite good. - Resulting HTML is less than *half* of the previous size. All previous links/bookmarks should continue to work. [1] https://github.com/asciidoctor/kramdown-asciidoc
2023-07-27 23:45:17 -04:00
= Virtual Topics
Virtual Topics (a specialisation of virtual destinations) in ActiveMQ "Classic" typically address two different but related problems.
Let's take each in turn:
== Shared access to a JMS durable topic subscription
With JMS1.1, a durable subscription is identified by the pair of clientId and subscriptionName.
The clientId component must be unique to a connection on the broker.
This means that the subscription is exclusive.
It is not possible to load balance the stream of messages across consumers and quick failover is difficult because the existing connection state on the broker needs to be first disposed.
With virtual topics, each subscription's stream of messages is redirected to a queue.
In Artemis there are two alternatives, the new JMS 2.0 api or direct access to a subscription queue via the FQQN.
== JMS 2.0 shared subscriptions
JMS 2.0 adds the possibility of shared subscriptions with new API's that are fully supported in Artemis.
== Fully Qualified Queue name (FQQN)
Secondly, Artemis uses a queue per topic subscriber model internally, and it is possibly to directly address the subscription queue using its Fully Qualified Queue name (FQQN).
For example, a default 5.x consumer destination for topic `VirtualTopic.Orders` subscription `A`:
----
...
Queue subscriptionQueue = session.createQueue("Consumer.A.VirtualTopic.Orders");
session.createConsumer(subscriptionQueue);
----
would be replaced with an Artemis FQQN comprised of the address and queue.
----
...
Queue subscriptionQueue = session.createQueue("VirtualTopic.Orders::Consumer.A.VirtualTopic.Orders");
session.createConsumer(subscriptionQueue);
----
This does require modification to the destination name used by consumers which is not ideal.
If OpenWire clients cannot be modified, Artemis supports a virtual topic wildcard filter mechanism on the OpenWire protocol handler that will automatically convert the consumer destination into the corresponding FQQN.
The format is a comma separated list of strings pairs, delimited with a ';'.
Each pair identifies a filter to match the virtual topic consumer destination, and an int that specifies the number of path matches that terminate the consumer queue identity.
E.g: For the default 5.x virtual topic consumer prefix of `Consumer.*.` the parameter `virtualTopicConsumerWildcards` should be: `Consumer.*.>;2`.
However, there is a caveat because this value needs to be encoded in a uri for the xml configuration.
Any unsafe url characters , in this case: `> ;` need to be escaped with their hex code point representation;
leading to a value of `Consumer.*.%3E%3B2`.
In this way a consumer destination of `Consumer.A.VirtualTopic.Orders` will be transformed into a FQQN of `VirtualTopic.Orders::Consumer.A.VirtualTopic.Orders`.
== Durable topic subscribers in a network of brokers
The store and forward network bridges in 5.x create a durable subscriber per destination.
As demand migrates across a network, duplicate durable subs get created on each node in the network, but they do not migrate.
The end result can result in duplicate message storage and ultimately duplicate delivery, which is not good.
When durable subscribers map to virtual topic subscriber queues, the queues can migrate, and the problem can be avoided.
In Artemis, because a durable sub is modeled as a queue, this problem does not arise.