Mike Zhou
Mike Zhou

Reputation: 15

Where is GridStreamerWindow<Event> Event type info specified

In the Gridgain 6.0 streamer example StreamingCheckInExample.java, two windows are defined in the config.xml file. In the following code, the event type for the window is of type LocationInfo. I am wondering where is the window event type info specified?

private static class DetectPlacesStage implements GridStreamerStage<CheckInEvent> {
    ...

    @Nullable @Override public Map<String, Collection<?>> run(GridStreamerContext ctx,
        Collection<CheckInEvent> evts) throws GridException {
        GridStreamerWindow<LocationInfo> win = ctx.window(name());
        ...

Upvotes: 1

Views: 47

Answers (1)

Yakov
Yakov

Reputation: 126

GridStreamerWindow has type parameter which is the type of the events passed to streamer. Method to get window in GridStreamerContext has the following signature:

public <E> GridStreamerWindow<E> window(); Which makes possible to get window working with event types you need.

Events get to the window when you pass them to GridStreamer:

public void addEvent(Object evt, Object... evts) throws GridException;

Events instantiation is under user control. So, user knows what type is expected in the window.

Please let me know if you have more questions.

Upvotes: 1

Related Questions