Can we opt to receive all responses to a broadcast?

I’m new to Netifi, so I apologize for any weird questions :stuck_out_tongue:

Let’s say I want to send a broadcast message to everyone in a group. The documentation states that the broker will return only one result from all of the results gathered in that group. What if I’m interested in getting all of the results? Is there an option to request that info?

Or is it better to design the system in such a way that the clients in the broadcast group simply send a message down a different path when they receive the broadcast message.

As a quick example:

Service broadcasts “Update Stats”, and ignores the response. All clients in that broadcast group then send a message down another service of “Current Stats”.

At least that method forces the service to truly be stateless.

Thoughts?

Hi,

There are a couple ways to do this. You can use request channel or fire-and-forget. Everyone in the group will receive the message.

Here’s an example protobuf that uses fire and forget. Everyone in the group should receive this message:

syntax = "proto3";

package com.netifi.demo.helloworld;

import "google/protobuf/empty.proto";
import "rsocket/options.proto";

option java_package = "com.netifi.demo.helloworld";
option java_outer_classname = "HelloWorldServiceProto";
option java_multiple_files = true;

message HelloRequest {
  string name = 1;
}

message HelloResponse {
  string message = 1;
}

service HelloWorldService {
  rpc SayHelloToEmptyRoom (HelloRequest) returns (google.protobuf.Empty) {
      option (io.rsocket.rpc.options) = {
        fire_and_forget: true
      };
  }
}