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

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

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

origin: apache/nifi

  protected void sendMessage(final byte[] buffer) throws ProcessException {

    final EventHubClient sender = senderQueue.poll();
    if(null != sender) {
      try {
        sender.sendSync(new EventData(buffer));
      } catch (final ServiceBusException sbe) {
        throw new ProcessException("Caught exception trying to send message to eventbus", sbe);
      } finally {
        senderQueue.offer(sender);
      }
    }else{
      throw new ProcessException("No EventHubClients are configured for sending");
    }

  }
}
origin: apache/storm

@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);
  }
}
origin: Azure/azure-event-hubs-java

public void send(final byte[] msg) throws EventHubException {
  if (msg != null) {
    EventData data = EventData.create(msg);
    this.eventHubSender.sendSync(data);
  }
}
origin: Azure/azure-event-hubs-java

public void send(final Iterable<byte[]> messages) throws EventHubException {
  if (messages != null) {
    LinkedList<EventData> events = new LinkedList<EventData>();
    for (byte[] message : messages) {
      events.add(EventData.create(message));
    }
    this.eventHubSender.sendSync(events);
  }
}
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.eventhubsEventHubClientsendSync

Javadoc

Synchronous version of #send(EventData).

Popular methods of EventHubClient

  • createSync
  • createPartitionSenderSync
  • send
  • close
  • closeSync
  • 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
  • putExtra (Intent)
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Top plugins for Android Studio
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