From 53b1f829f6db6961809829c7fd8089042b6af48d Mon Sep 17 00:00:00 2001 From: ggreen Date: Thu, 20 Nov 2025 12:50:43 -0500 Subject: [PATCH] Adding documentation to provide an example Spring AMPQ RabbitMQ Stream plugin support to set the Super Stream Routing Signed-off-by: Gregory Green --- .../antora/modules/ROOT/pages/stream.adoc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/reference/antora/modules/ROOT/pages/stream.adoc b/src/reference/antora/modules/ROOT/pages/stream.adoc index 2aa38a71f9..f45cfd6809 100644 --- a/src/reference/antora/modules/ROOT/pages/stream.adoc +++ b/src/reference/antora/modules/ROOT/pages/stream.adoc @@ -262,12 +262,24 @@ You must add a `superStreamRoutingFunction` to the `RabbitStreamTemplate`: RabbitStreamTemplate streamTemplate(Environment env) { RabbitStreamTemplate template = new RabbitStreamTemplate(env, "stream.queue1"); template.setSuperStreamRouting(message -> { - // some logic to return a String for the client's hashing algorithm + // some logic to return a String for the client's routing hashing algorithm + return message.getApplicationProperties().get("ROUTING_KEY").toString(); }); return template; } ---- +The following is an example of sending a message using a RabbitStreamTemplate + +[source, java] +---- + //Send a message with the routing property for the hashing algorithm + rabbitStreamTemplate.send(rabbitStreamTemplate + .messageBuilder().addData(converter.convert(domainObject)) + .applicationProperties().entry("ROUTING_KEY",domainObject.getId()) + .messageBuilder().build()); +---- + You can also publish over AMQP, using the `RabbitTemplate`. [[super-stream-consumer]]