Search in sources :

Example 16 with StreamEventConverter

use of org.wso2.siddhi.core.event.stream.converter.StreamEventConverter in project siddhi by wso2.

the class MultiProcessStreamReceiver method receive.

@Override
public void receive(Event event, boolean endOfBatch) {
    eventBuffer.add(event);
    if (endOfBatch) {
        for (Event aEvent : eventBuffer) {
            synchronized (this) {
                stabilizeStates();
                for (int anEventSequence : eventSequence) {
                    StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
                    StreamEventPool aStreamEventPool = streamEventPools[anEventSequence];
                    StreamEvent borrowedEvent = aStreamEventPool.borrowEvent();
                    aStreamEventConverter.convertEvent(aEvent, borrowedEvent);
                    process(anEventSequence, borrowedEvent);
                }
            }
        }
        eventBuffer.clear();
    }
}
Also used : StreamEventConverter(org.wso2.siddhi.core.event.stream.converter.StreamEventConverter) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent) StreamEventPool(org.wso2.siddhi.core.event.stream.StreamEventPool) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent) ComplexEvent(org.wso2.siddhi.core.event.ComplexEvent) Event(org.wso2.siddhi.core.event.Event)

Example 17 with StreamEventConverter

use of org.wso2.siddhi.core.event.stream.converter.StreamEventConverter in project siddhi by wso2.

the class MultiProcessStreamReceiver method receive.

@Override
public void receive(Event[] events) {
    for (Event event : events) {
        synchronized (this) {
            stabilizeStates();
            for (int anEventSequence : eventSequence) {
                StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
                StreamEventPool aStreamEventPool = streamEventPools[anEventSequence];
                StreamEvent borrowedEvent = aStreamEventPool.borrowEvent();
                aStreamEventConverter.convertEvent(event, borrowedEvent);
                process(anEventSequence, borrowedEvent);
            }
        }
    }
}
Also used : StreamEventConverter(org.wso2.siddhi.core.event.stream.converter.StreamEventConverter) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent) StreamEventPool(org.wso2.siddhi.core.event.stream.StreamEventPool) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent) ComplexEvent(org.wso2.siddhi.core.event.ComplexEvent) Event(org.wso2.siddhi.core.event.Event)

Example 18 with StreamEventConverter

use of org.wso2.siddhi.core.event.stream.converter.StreamEventConverter in project siddhi by wso2.

the class Scheduler method setStreamEventPool.

public void setStreamEventPool(StreamEventPool streamEventPool) {
    this.streamEventPool = streamEventPool;
    streamEventChunk = new ConversionStreamEventChunk((StreamEventConverter) null, streamEventPool);
}
Also used : ConversionStreamEventChunk(org.wso2.siddhi.core.event.stream.converter.ConversionStreamEventChunk) StreamEventConverter(org.wso2.siddhi.core.event.stream.converter.StreamEventConverter)

Aggregations

StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)15 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)15 StreamEventConverter (org.wso2.siddhi.core.event.stream.converter.StreamEventConverter)10 Test (org.testng.annotations.Test)9 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)9 ConversionStreamEventChunk (org.wso2.siddhi.core.event.stream.converter.ConversionStreamEventChunk)7 Event (org.wso2.siddhi.core.event.Event)5 ZeroStreamEventConverter (org.wso2.siddhi.core.event.stream.converter.ZeroStreamEventConverter)5 ComplexEvent (org.wso2.siddhi.core.event.ComplexEvent)4 Attribute (org.wso2.siddhi.query.api.definition.Attribute)4 MetaStateEvent (org.wso2.siddhi.core.event.state.MetaStateEvent)3 SelectiveStreamEventConverter (org.wso2.siddhi.core.event.stream.converter.SelectiveStreamEventConverter)3 SimpleStreamEventConverter (org.wso2.siddhi.core.event.stream.converter.SimpleStreamEventConverter)3 StreamDefinition (org.wso2.siddhi.query.api.definition.StreamDefinition)3 BeforeMethod (org.testng.annotations.BeforeMethod)1 ComplexEventChunk (org.wso2.siddhi.core.event.ComplexEventChunk)1 StateEvent (org.wso2.siddhi.core.event.state.StateEvent)1 StateEventPool (org.wso2.siddhi.core.event.state.StateEventPool)1 SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)1 DeleteTableCallback (org.wso2.siddhi.core.query.output.callback.DeleteTableCallback)1