Hi
I am trying to create a Polling container that accepts an array of events rather than a single event. However my implementation always throws a Class Cast Exception (because its passing a single event instead of an array). I must be doing something wrong, but I can't figure out what it is.
I also get the same exception using the sample code on the site;
@EventDriven
@Polling(passArrayAsIs = true)
public class SimpleBatchListener {
@ReceiveHandler
ReceiveOperationHandler receiveHandler() {
MultiTakeReceiveOperationHandler receiveHandler = new MultiTakeReceiveOperationHandler();
receiveHandler.setMaxEntries(100);
return receiveHandler;
}
@EventTemplate
ManualMatchEvent unprocessedData() {
ManualMatchEvent template = new ManualMatchEvent();
template.setProcessed(false);
return template;
}
@SpaceDataEvent
public ManualMatchEvent[] eventListener(ManualMatchEvent events[]) {
//process Data within a loop
for (int i = 0; i < events.length; i++) {
events[i].setProcessed(true);
}
return events;
}
}
org.openspaces.events.ListenerExecutionFailedException: Listener event method [eventListener] of class [SimpleBatchListener] threw exception; nested exception is java.lang.ClassCastException:
ManualMatchEvent cannot be cast to [LManualMatchEvent;
at org.openspaces.events.adapter.AbstractReflectionEventListenerAdapter.onEventWithResult(AbstractReflectionEventListenerAdapter.java:178) ~[gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at org.openspaces.events.adapter.AbstractResultEventListenerAdapter.onEvent(AbstractResultEventListenerAdapter.java:75) ~[gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at org.openspaces.events.AbstractEventListenerContainer.invokeListener(AbstractEventListenerContainer.java:194) ~[gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at org.openspaces.events.polling.AbstractPollingEventListenerContainer.doReceiveAndExecute(AbstractPollingEventListenerContainer.java:288) [gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at org.openspaces.events.polling.AbstractPollingEventListenerContainer.receiveAndExecute(AbstractPollingEventListenerContainer.java:274) [gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at org.openspaces.events.polling.SimplePollingEventListenerContainer$AsyncEventListenerInvoker.invokeListener(SimplePollingEventListenerContainer.java:721) [gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at org.openspaces.events.polling.SimplePollingEventListenerContainer$AsyncEventListenerInvoker.run(SimplePollingEventListenerContainer.java:662) [gs-openspaces-10.0.1-XAPPremium-ga.jar:10.0.1-11800-RELEASE]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80]
↧