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

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

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

origin: Azure/azure-event-hubs-java

/**
 * Synchronous version of {@link #create(String, ScheduledExecutorService)}.
 *
 * @param connectionString The connection string to be used. See {@link ConnectionStringBuilder} to construct a connectionString.
 * @param executor         An {@link ScheduledExecutorService} to run all tasks performed by {@link EventHubClient}.
 * @return EventHubClient which can be used to create Senders and Receivers to EventHub
 * @throws EventHubException If Service Bus service encountered problems during connection creation.
 * @throws IOException       If the underlying Proton-J layer encounter network errors.
 */
static EventHubClient createSync(final String connectionString, final ScheduledExecutorService executor)
    throws EventHubException, IOException {
  return EventHubClient.createSync(connectionString, null, executor);
}
origin: Azure/azure-event-hubs-java

  public void startup() throws EventHubException, IOException {
    this.eventHubSender = EventHubClient.createSync(this.eventHubConnectionString, EXECUTOR_SERVICE);
  }
}
origin: Microsoft/spring-cloud-azure

private EventHubClient createEventHubClient(String eventHubName) {
  try {
    return EventHubClient.createSync(this.connectionStringProvider.getConnectionString(eventHubName),
        Executors.newSingleThreadScheduledExecutor());
  } catch (EventHubException | IOException e) {
    throw new EventHubRuntimeException("Error when creating event hub client", e);
  }
}
origin: com.microsoft.azure/spring-integration-eventhub

private EventHubClient createEventHubClient(String eventHubName) {
  try {
    return EventHubClient.createSync(this.connectionStringProvider.getConnectionString(eventHubName),
        Executors.newSingleThreadExecutor());
  } catch (EventHubException | IOException e) {
    throw new EventHubRuntimeException("Error when creating event hub client", e);
  }
}
origin: com.erudika/para-server

private static EventHubClient receiveEventsAsync(final String partitionId) {
  EventHubClient client = null;
  try {
    client = EventHubClient.createSync(EVENTHUB_CONN_STR, Para.getExecutorService());
    client.createReceiver(EventHubClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId,
          EventPosition.fromEnqueuedTime(Instant.now())).
        thenAccept(new Receiver(partitionId));
  } catch (Exception e) {
    logger.warn("Couldn't start receiving messages from Azure cloud: {}", e.getMessage());
  }
  return client;
}
origin: Erudika/para

private static EventHubClient receiveEventsAsync(final String partitionId) {
  EventHubClient client = null;
  try {
    client = EventHubClient.createSync(EVENTHUB_CONN_STR, Para.getExecutorService());
    client.createReceiver(EventHubClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId,
          EventPosition.fromEnqueuedTime(Instant.now())).
        thenAccept(new Receiver(partitionId));
  } catch (Exception e) {
    logger.warn("Couldn't start receiving messages from Azure cloud: {}", e.getMessage());
  }
  return client;
}
origin: apache/samza

@Override
public void init() {
 String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace);
 LOG.info("Initializing SamzaEventHubClientManager for namespace: " + eventHubNamespace);
 try {
  ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder()
    .setNamespaceName(eventHubNamespace)
    .setEventHubName(entityPath)
    .setSasKeyName(sasKeyName)
    .setSasKey(sasKey);
  ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder().setNameFormat("Samza EventHubClient Thread-%d").setDaemon(true);
  eventHubClientExecutor = Executors.newFixedThreadPool(numClientThreads, threadFactoryBuilder.build());
  eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, eventHubClientExecutor);
 } catch (IOException | EventHubException e) {
  String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d",
      entityPath, remoteHost, ClientConstants.AMQPS_PORT);
  LOG.error(msg, e);
  throw new SamzaException(msg, e);
 }
 LOG.info("SamzaEventHubClientManager initialized for namespace: " + eventHubNamespace);
}
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.eventhubsEventHubClientcreateSync

Javadoc

Synchronous version of #create(String,ScheduledExecutorService).

Popular methods of EventHubClient

  • createPartitionSenderSync
  • send
  • close
  • closeSync
  • 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

  • Reading from database using SQL prepared statement
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Collectors (java.util.stream)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • From CI to AI: The AI layer in your organization
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