Search in sources :

Example 6 with PipelineException

use of org.openkilda.wfm.error.PipelineException in project open-kilda by telstra.

the class WorkerBolt method emitResponseToHub.

/**
 * Send response to the hub bolt. Note: the operation's key is required.
 * @param input request or response tuple (use key to lookup original request).
 * @param values response to be sent to the hub.
 */
protected void emitResponseToHub(Tuple input, Values values) {
    String key;
    try {
        key = pullKey(input);
    } catch (PipelineException e) {
        throw new IllegalStateException(String.format("Can't extract request key from %s: %s", input, e), e);
    }
    cancelCallback(key);
    Tuple processingRequest = pendingTasks.remove(key);
    if (processingRequest == null) {
        throw new IllegalStateException(format("Attempt to send response for non pending task with id %s", key));
    }
    getOutput().emitDirect(processingRequest.getSourceTask(), workerConfig.getStreamToHub(), getCurrentTuple(), values);
}
Also used : PipelineException(org.openkilda.wfm.error.PipelineException) Tuple(org.apache.storm.tuple.Tuple)

Example 7 with PipelineException

use of org.openkilda.wfm.error.PipelineException in project open-kilda by telstra.

the class PortHandler method handleSpeakerBcast.

private void handleSpeakerBcast(Tuple input) {
    try {
        SpeakerBcast command = pullValue(input, SpeakerRouter.FIELD_ID_COMMAND, SpeakerBcast.class);
        command.apply(this);
    } catch (PipelineException e) {
        log.error("Handle speaker bcast command exception", e);
    }
}
Also used : PipelineException(org.openkilda.wfm.error.PipelineException) SpeakerBcast(org.openkilda.wfm.topology.network.storm.bolt.speaker.bcast.SpeakerBcast)

Aggregations

PipelineException (org.openkilda.wfm.error.PipelineException)7 Tuple (org.apache.storm.tuple.Tuple)5 TimeUnit (java.util.concurrent.TimeUnit)2 Collectors (java.util.stream.Collectors)2 OutputFieldsDeclarer (org.apache.storm.topology.OutputFieldsDeclarer)2 Fields (org.apache.storm.tuple.Fields)2 Values (org.apache.storm.tuple.Values)2 Flow (org.openkilda.model.Flow)2 PersistenceContextRequired (org.openkilda.persistence.context.PersistenceContextRequired)2 FlowResourcesManager (org.openkilda.wfm.share.flow.resources.FlowResourcesManager)2 PingContext (org.openkilda.wfm.topology.ping.model.PingContext)2 String.format (java.lang.String.format)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Stream (java.util.stream.Stream)1