Skip to content

Commit

Permalink
Added partition key in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SravanThotakura05 committed Feb 5, 2024
1 parent b331e5f commit 3ebef38
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,31 @@ public class TemperaturesProducer {
}
----

Generating `org.eclipse.microprofile.reactive.messaging.Message` with partition key and publish to Solace.

[source,java]
----
@ApplicationScoped
public class TemperaturesProducer {
private final Random random = new Random();
@Outgoing("temperatures-out")
Multi<Message<Double>> publishTemperatures() {
return Multi.createFrom().range(0, 1000)
.map(i -> {
String partitionKey = "Group-1";
if(i % 2 == 0) {
partitionKey = "Group-2";
}
SolaceOutboundMetadata outboundMetadata = SolaceOutboundMetadata.builder()
.setApplicationMessageId(Integer.toString(i))
.setPartitionKey(partitionKey).createPubSubOutboundMetadata();
return Message.of(random.nextDouble(), Metadata.of(outboundMetadata));
});
}
}
----

Sending messages with __@Emitter__

[source,java]
Expand Down

0 comments on commit 3ebef38

Please sign in to comment.