Tabnine Logo
EventHubClient.closeSync
Code IndexAdd Tabnine to your IDE (free)

How to use
closeSync
method
in
com.microsoft.azure.eventhubs.EventHubClient

Best Java code snippets using com.microsoft.azure.eventhubs.EventHubClient.closeSync (Showing top 5 results out of 315)

origin: apache/storm

@Override
public void close() {
  if (receiver != null) {
    try {
      receiver.close().whenComplete((voidargs, error) -> {
        try {
          if (error != null) {
            logger.error("Exception during receiver close phase" + error.toString());
          }
          ehClient.closeSync();
        } catch (Exception e) {
          logger.error("Exception during ehclient close phase" + e.toString());
        }
      }).get();
    } catch (InterruptedException e) {
      logger.error("Exception occured during close phase" + e.toString());
    } catch (ExecutionException e) {
      logger.error("Exception occured during close phase" + e.toString());
    }
    logger.info("closed eventhub receiver: partitionId=" + partitionId);
    receiver = null;
    ehClient = null;
  }
}
origin: apache/storm

@Override
public void cleanup() {
  if (sender != null) {
    try {
      sender.close().whenComplete((voidargs, error) -> {
        try {
          if (error != null) {
            logger.error("Exception during sender cleanup phase" + error.toString());
          }
          ehClient.closeSync();
        } catch (Exception e) {
          logger.error("Exception during ehclient cleanup phase" + e.toString());
        }
      }).get();
    } catch (InterruptedException e) {
      logger.error("Exception occured during cleanup phase" + e.toString());
    } catch (ExecutionException e) {
      logger.error("Exception occured during cleanup phase" + e.toString());
    }
    logger.info("Eventhub Bolt cleaned up");
    sender = null;
    ehClient = null;
  }
}
origin: apache/nifi

@OnStopped
public void tearDown() throws ProcessException {
  for (final PartitionReceiver receiver : partitionToReceiverMap.values()) {
    if (null != receiver) {
      receiver.close();
    }
  }
  partitionToReceiverMap.clear();
  try {
    if (null != eventHubClient) {
      eventHubClient.closeSync();
    }
  } catch (final ServiceBusException e) {
    throw new ProcessException(e);
  }
}
origin: apache/samza

@Override
public void close(long timeoutMS) {
 try {
  if (timeoutMS == EventHubClientManager.BLOCK_UNTIL_CLOSE) {
   eventHubClient.closeSync();
   eventHubClientExecutor.shutdown();
  } else {
   CompletableFuture<Void> future = eventHubClient.close();
   future.get(timeoutMS, TimeUnit.MILLISECONDS);
  }
 } catch (Exception e) {
  LOG.error("Closing the EventHub client failed", e);
 }
}
origin: sitewhere/sitewhere

@Test
public void doAzureEventSourceSendTest() throws Exception {
ExecutorService executor = Executors.newSingleThreadExecutor();
final ConnectionStringBuilder connStr = new ConnectionStringBuilder().setNamespaceName("sitewhere")
  .setEventHubName("events").setSasKeyName("RootManageSharedAccessKey").setSasKey("xxx");
byte[] payloadBytes = EventsHelper.generateJsonMeasurementsMessage(DEVICE_TOKEN);
EventData sendEvent = EventData.create(payloadBytes);
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString(), executor);
ehClient.sendSync(sendEvent);
ehClient.closeSync();
executor.shutdown();
}
com.microsoft.azure.eventhubsEventHubClientcloseSync

Popular methods of EventHubClient

  • createSync
  • createPartitionSenderSync
  • send
  • close
  • sendSync
    Synchronous version of #send(Iterable,String).
  • createReceiver
  • getRuntimeInformation
    Retrieves general information about an event hub (see EventHubRuntimeInformation for details). Retri
  • create
    Factory method to create an instance of EventHubClient using the supplied connectionString. In a nor
  • createEpochReceiver
    Create a Epoch based EventHub receiver with given partition id and start receiving from the beginnin
  • createReceiverSync
    Synchronous version of #createReceiver(String,String,EventPosition).
  • getPartitionRuntimeInformation
    Retrieves dynamic information about a partition of an event hub (see PartitionRuntimeInformation for
  • createBatch
  • getPartitionRuntimeInformation,
  • createBatch,
  • createEpochReceiverSync,
  • createFromConnectionString,
  • createFromConnectionStringSync,
  • createPartitionSender

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now