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

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

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

origin: Azure/azure-event-hubs-java

/**
 * Synchronous version of {@link #send(EventData, String)}.
 *
 * @param eventData    the {@link EventData} to be sent.
 * @param partitionKey the partitionKey will be hash'ed to determine the partitionId to send the eventData to. On the Received message this can be accessed at {@link EventData.SystemProperties#getPartitionKey()}
 * @throws PayloadSizeExceededException if the total size of the {@link EventData} exceeds a pre-defined limit set by the service. Default is 256k bytes.
 * @throws EventHubException            if Service Bus service encountered problems during the operation.
 */
default void sendSync(final EventData eventData, final String partitionKey) throws EventHubException {
  ExceptionUtil.syncVoid(() -> this.send(eventData, partitionKey).get());
}
origin: Azure/azure-event-hubs-java

/**
 * Synchronous version of {@link #send(EventData)}.
 *
 * @param data the {@link EventData} to be sent.
 * @throws PayloadSizeExceededException if the total size of the {@link EventData} exceeds a predefined limit set by the service. Default is 256k bytes.
 * @throws EventHubException            if Service Bus service encountered problems during the operation.
 * @throws UnresolvedAddressException   if there are Client to Service network connectivity issues, if the Azure DNS resolution of the ServiceBus Namespace fails (ex: namespace deleted etc.)
 */
default void sendSync(final EventData data) throws EventHubException {
  ExceptionUtil.syncVoid(() -> this.send(data).get());
}
origin: Azure/azure-event-hubs-java

/**
 * Synchronous version of {@link #send(EventDataBatch)}.
 *
 * @param eventDatas EventDataBatch to send to EventHub
 * @throws EventHubException if Service Bus service encountered problems during the operation.
 */
default void sendSync(final EventDataBatch eventDatas) throws EventHubException {
  ExceptionUtil.syncVoid(() -> this.send(eventDatas).get());
}
origin: Azure/azure-event-hubs-java

/**
 * Synchronous version of {@link #send(Iterable, String)}.
 *
 * @param eventDatas   the batch of events to send to EventHub
 * @param partitionKey the partitionKey will be hash'ed to determine the partitionId to send the eventData to. On the Received message this can be accessed at {@link EventData.SystemProperties#getPartitionKey()}
 * @throws PayloadSizeExceededException if the total size of the {@link EventData} exceeds a pre-defined limit set by the service. Default is 256k bytes.
 * @throws EventHubException            if Service Bus service encountered problems during the operation.
 * @throws UnresolvedAddressException   if there are Client to Service network connectivity issues, if the Azure DNS resolution of the ServiceBus Namespace fails (ex: namespace deleted etc.)
 */
default void sendSync(final Iterable<EventData> eventDatas, final String partitionKey) throws EventHubException {
  ExceptionUtil.syncVoid(() -> this.send(eventDatas, partitionKey).get());
}
origin: Azure/azure-event-hubs-java

/**
 * Synchronous version of {@link #send(Iterable)}.
 *
 * @param eventDatas batch of events to send to EventHub
 * @throws PayloadSizeExceededException if the total size of the {@link EventData} exceeds a pre-defined limit set by the service. Default is 256k bytes.
 * @throws EventHubException            if Service Bus service encountered problems during the operation.
 * @throws UnresolvedAddressException   if there are Client to Service network connectivity issues, if the Azure DNS resolution of the ServiceBus Namespace fails (ex: namespace deleted etc.)
 */
default void sendSync(final Iterable<EventData> eventDatas) throws EventHubException {
  ExceptionUtil.syncVoid(() -> this.send(eventDatas).get());
}
origin: com.microsoft.azure/spring-integration-eventhub

private CompletableFuture<Void> doSend(String eventHubName, PartitionSupplier partitionSupplier,
    List<EventData> eventData) {
  try {
    EventHubClient client = this.clientFactory.getOrCreateClient(eventHubName);
    if (partitionSupplier == null) {
      return client.send(eventData);
    } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionId())) {
      return this.clientFactory.getOrCreatePartitionSender(eventHubName, partitionSupplier.getPartitionId())
                   .send(eventData);
    } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionKey())) {
      return client.send(eventData, partitionSupplier.getPartitionKey());
    } else {
      return client.send(eventData);
    }
  } catch (EventHubRuntimeException e) {
    log.error(String.format("Failed to send to '%s' ", eventHubName), e);
    CompletableFuture<Void> future = new CompletableFuture<>();
    future.completeExceptionally(e);
    return future;
  }
}
origin: Microsoft/spring-cloud-azure

private CompletableFuture<Void> doSend(String eventHubName, PartitionSupplier partitionSupplier,
    List<EventData> eventData) {
  try {
    EventHubClient client = this.clientFactory.getOrCreateClient(eventHubName);
    if (partitionSupplier == null) {
      return client.send(eventData);
    } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionId())) {
      return this.clientFactory.getOrCreatePartitionSender(eventHubName, partitionSupplier.getPartitionId())
                   .send(eventData);
    } else if (!Strings.isNullOrEmpty(partitionSupplier.getPartitionKey())) {
      return client.send(eventData, partitionSupplier.getPartitionKey());
    } else {
      return client.send(eventData);
    }
  } catch (EventHubRuntimeException e) {
    log.error(String.format("Failed to send to '%s' ", eventHubName), e);
    CompletableFuture<Void> future = new CompletableFuture<>();
    future.completeExceptionally(e);
    return future;
  }
}
origin: apache/samza

private CompletableFuture<Void> sendToEventHub(String streamId, EventData eventData, Object partitionKey,
  EventHubClient eventHubClient) {
 if (PartitioningMethod.ROUND_ROBIN.equals(partitioningMethod)) {
  return eventHubClient.send(eventData);
 } else if (PartitioningMethod.EVENT_HUB_HASHING.equals(partitioningMethod)) {
  if (partitionKey == null) {
   throw new SamzaException("Partition key cannot be null for EventHub hashing");
  }
  return eventHubClient.send(eventData, convertPartitionKeyToString(partitionKey));
 } else if (PartitioningMethod.PARTITION_KEY_AS_PARTITION.equals(partitioningMethod)) {
  if (!(partitionKey instanceof Integer)) {
   String msg = "Partition key should be of type Integer";
   throw new SamzaException(msg);
  }
  Integer numPartition = streamPartitionSenders.get(streamId).size();
  Integer destinationPartition = (Integer) partitionKey % numPartition;
  PartitionSender sender = streamPartitionSenders.get(streamId).get(destinationPartition);
  return sender.send(eventData);
 } else {
  throw new SamzaException("Unknown partitioning method " + partitioningMethod);
 }
}
origin: apache/samza

PowerMockito.when(mockEventHubClient.send(any(EventData.class), anyString()))
    .then((Answer<CompletableFuture<Void>>) invocationOnMock -> {
      EventData data = invocationOnMock.getArgumentAt(0, EventData.class);
com.microsoft.azure.eventhubsEventHubClientsend

Javadoc

Send EventData to EventHub. The sent EventData will land on any arbitrarily chosen EventHubs partition.

There are 3 ways to send to EventHubs, each exposed as a method (along with its sendBatch overload):

  • #send(EventData), #send(Iterable), or #send(EventDataBatch)
  • #send(EventData,String) or #send(Iterable,String)
  • PartitionSender#send(EventData), PartitionSender#send(Iterable), or PartitionSender#send(EventDataBatch)

Use this method to Send, if:

 
a)  the send( 
EventData) operation should be highly available and 
b)  the data needs to be evenly distributed among all partitions; exception being, when a subset of partitions are unavailable 

#send(EventData) send's the EventData to a Service Gateway, which in-turn will forward the EventData to one of the EventHubs' partitions. Here's the message forwarding algorithm:

 
i.  Forward the  
EventData's to EventHub partitions, by equally distributing the data among all partitions (ex: Round-robin the  
EventData's to all EventHubs' partitions) 
ii. If one of the EventHub partitions is unavailable for a moment, the Service Gateway will automatically detect it and forward the message to another available partition - making the Send operation highly-available. 

Popular methods of EventHubClient

  • createSync
    Synchronous version of #create(String,ScheduledExecutorService).
  • createPartitionSenderSync
  • 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

  • Running tasks concurrently on multiple threads
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Github Copilot alternatives
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