Github user harshach commented on a diff in the pull request:
https://github.com/apache/storm/pull/1998#discussion_r106768060
--- Diff:
external/storm-eventhubs/src/main/java/org/apache/storm/eventhubs/bolt/EventHubBolt.java
---
@@ -84,11 +85,47 @@ public void prepare(Map config, TopologyContext context,
@Override
public void execute(Tuple tuple) {
try {
-
sender.send(boltConfig.getEventDataFormat().serialize(tuple));
+ 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) {
+ } catch (EventHubException ex ) {
collector.reportError(ex);
collector.fail(tuple);
+ }catch (ServiceBusException e){
+ collector.reportError(e);
+ collector.fail(tuple);
+ }
+ }
+
+ @Override
+ public void cleanup() {
+ if(sender != null) {
+ try {
+ sender.close().whenComplete((voidargs,error)->{
--- End diff --
FYI, 1.x-branch still is on JDK 1.7 make sure you open another PR for
1.x-branch with JDK7 changes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---