How to obtain GridStreamer on remote node without streaming configuration

StackOverflow https://stackoverflow.com/questions/22533624

  •  18-06-2023
  •  | 
  •  

Domanda

In GridGain 6, can I obtain GridStreamer instance on remote node and use it to addEvents?

The idea is that I need a node, which can generate data for stream processing, but not to participate in processing itself.

All nodes, launched with StreamConfiguration section automatically participate in processing of events. And if node is launched without StreamConfiguration section - then its Grid instance don't see other streamers.

GridClient seems don't support streaming

È stato utile?

Soluzione

You cannot get streamer instance on node which does not have this particular streamer configured. However, you can easily achieve your requirement by providing GridStreamerEventRouter that will not route events on nodes which are not supposed to participate in event processing.

For example, you can use random event router with predicate which will filter nodes by user attribute (you can set user attributes for a node with GridConfiguration.setUserAttributes(...)):

GridStreamerConfiguration streamCfg = new GridStreamerConfiguration();
//...
streamCfg.setRouter(new GridStreamerRandomEventRouter(new GridPredicate<GridNode>() {
    @Override public boolean apply(GridNode node) {
        return !"CLIENT".equals(node.attribute("STREAMER_ROLE"));
    }
}));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top