Search in sources :

Example 1 with DefinitionNotExistException

use of org.ballerinalang.siddhi.core.exception.DefinitionNotExistException in project ballerina by ballerina-lang.

the class SiddhiAppRuntime method addCallback.

public void addCallback(String streamId, StreamCallback streamCallback) {
    streamCallback.setStreamId(streamId);
    StreamJunction streamJunction = streamJunctionMap.get(streamId);
    if (streamJunction == null) {
        throw new DefinitionNotExistException("No stream found with name: " + streamId);
    }
    streamCallback.setStreamDefinition(streamDefinitionMap.get(streamId));
    streamCallback.setContext(siddhiAppContext);
    streamJunction.subscribe(streamCallback);
}
Also used : StreamJunction(org.ballerinalang.siddhi.core.stream.StreamJunction) DefinitionNotExistException(org.ballerinalang.siddhi.core.exception.DefinitionNotExistException)

Example 2 with DefinitionNotExistException

use of org.ballerinalang.siddhi.core.exception.DefinitionNotExistException in project ballerina by ballerina-lang.

the class InputManager method constructInputHandler.

public InputHandler constructInputHandler(String streamId) {
    InputHandler inputHandler = new InputHandler(streamId, inputHandlerMap.size(), inputEntryValve);
    StreamJunction streamJunction = streamJunctionMap.get(streamId);
    if (streamJunction == null) {
        throw new DefinitionNotExistException("Stream with stream ID " + streamId + " has not been defined");
    }
    inputDistributor.addInputProcessor(streamJunctionMap.get(streamId).constructPublisher());
    inputHandlerMap.put(streamId, inputHandler);
    return inputHandler;
}
Also used : StreamJunction(org.ballerinalang.siddhi.core.stream.StreamJunction) DefinitionNotExistException(org.ballerinalang.siddhi.core.exception.DefinitionNotExistException)

Aggregations

DefinitionNotExistException (org.ballerinalang.siddhi.core.exception.DefinitionNotExistException)2 StreamJunction (org.ballerinalang.siddhi.core.stream.StreamJunction)2