use of org.apache.storm.eventhubs.spout.EventHubException in project storm by apache.
the class EventHubBolt method execute.
@Override
public void execute(Tuple tuple) {
try {
EventData sendEvent = new EventData(boltConfig.getEventDataFormat().serialize(tuple));
if (boltConfig.getPartitionMode() && sender != null) {
sender.sendSync(sendEvent);
} else if (boltConfig.getPartitionMode() && sender == null) {
throw new EventHubException("Sender is null");
} else if (!boltConfig.getPartitionMode() && ehClient != null) {
ehClient.sendSync(sendEvent);
} else if (!boltConfig.getPartitionMode() && ehClient == null) {
throw new EventHubException("ehclient is null");
}
collector.ack(tuple);
} catch (EventHubException ex) {
collector.reportError(ex);
collector.fail(tuple);
} catch (ServiceBusException e) {
collector.reportError(e);
collector.fail(tuple);
}
}
Aggregations