Skip to content

Commit 53b1f82

Browse files
Adding documentation to provide an example Spring AMPQ RabbitMQ Stream plugin support to set the Super Stream Routing
Signed-off-by: Gregory Green <ggreen@cloudnativedata.io>
1 parent d684fcb commit 53b1f82

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/reference/antora/modules/ROOT/pages/stream.adoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,24 @@ You must add a `superStreamRoutingFunction` to the `RabbitStreamTemplate`:
262262
RabbitStreamTemplate streamTemplate(Environment env) {
263263
RabbitStreamTemplate template = new RabbitStreamTemplate(env, "stream.queue1");
264264
template.setSuperStreamRouting(message -> {
265-
// some logic to return a String for the client's hashing algorithm
265+
// some logic to return a String for the client's routing hashing algorithm
266+
return message.getApplicationProperties().get("ROUTING_KEY").toString();
266267
});
267268
return template;
268269
}
269270
----
270271

272+
The following is an example of sending a message using a RabbitStreamTemplate
273+
274+
[source, java]
275+
----
276+
//Send a message with the routing property for the hashing algorithm
277+
rabbitStreamTemplate.send(rabbitStreamTemplate
278+
.messageBuilder().addData(converter.convert(domainObject))
279+
.applicationProperties().entry("ROUTING_KEY",domainObject.getId())
280+
.messageBuilder().build());
281+
----
282+
271283
You can also publish over AMQP, using the `RabbitTemplate`.
272284

273285
[[super-stream-consumer]]

0 commit comments

Comments
 (0)