Search in sources :

Example 1 with EventHubException

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);
    }
}
Also used : ServiceBusException(com.microsoft.azure.servicebus.ServiceBusException) EventHubException(org.apache.storm.eventhubs.spout.EventHubException) EventData(com.microsoft.azure.eventhubs.EventData)

Aggregations

EventData (com.microsoft.azure.eventhubs.EventData)1 ServiceBusException (com.microsoft.azure.servicebus.ServiceBusException)1 EventHubException (org.apache.storm.eventhubs.spout.EventHubException)1