当前位置: 动力学知识库 > 问答 > 编程问答 >

gridgain - 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());

...

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: