Tabnine Logo
PublishRequest.getMessagesCount
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessagesCount
method
in
com.google.pubsub.v1.PublishRequest

Best Java code snippets using com.google.pubsub.v1.PublishRequest.getMessagesCount (Showing top 7 results out of 315)

origin: googleapis/google-cloud-java

@Override
public long countElements(PublishRequest request) {
 return request.getMessagesCount();
}
origin: googleapis/google-cloud-java

@java.lang.Override
public int hashCode() {
 if (memoizedHashCode != 0) {
  return memoizedHashCode;
 }
 int hash = 41;
 hash = (19 * hash) + getDescriptor().hashCode();
 hash = (37 * hash) + TOPIC_FIELD_NUMBER;
 hash = (53 * hash) + getTopic().hashCode();
 if (getMessagesCount() > 0) {
  hash = (37 * hash) + MESSAGES_FIELD_NUMBER;
  hash = (53 * hash) + getMessagesList().hashCode();
 }
 hash = (29 * hash) + unknownFields.hashCode();
 memoizedHashCode = hash;
 return hash;
}
origin: googleapis/google-cloud-java

@Test
public void testPublishByNumBatchedMessages() throws Exception {
 Publisher publisher =
   getTestPublisherBuilder()
     .setBatchingSettings(
       Publisher.Builder.DEFAULT_BATCHING_SETTINGS
         .toBuilder()
         .setElementCountThreshold(2L)
         .setDelayThreshold(Duration.ofSeconds(100))
         .build())
     .build();
 testPublisherServiceImpl
   .addPublishResponse(PublishResponse.newBuilder().addMessageIds("1").addMessageIds("2"))
   .addPublishResponse(PublishResponse.newBuilder().addMessageIds("3").addMessageIds("4"));
 ApiFuture<String> publishFuture1 = sendTestMessage(publisher, "A");
 ApiFuture<String> publishFuture2 = sendTestMessage(publisher, "B");
 ApiFuture<String> publishFuture3 = sendTestMessage(publisher, "C");
 // Note we are not advancing time but message should still get published
 assertEquals("1", publishFuture1.get());
 assertEquals("2", publishFuture2.get());
 assertFalse(publishFuture3.isDone());
 ApiFuture<String> publishFuture4 =
   publisher.publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8("D")).build());
 assertEquals("3", publishFuture3.get());
 assertEquals("4", publishFuture4.get());
 assertEquals(2, testPublisherServiceImpl.getCapturedRequests().get(0).getMessagesCount());
 assertEquals(2, testPublisherServiceImpl.getCapturedRequests().get(1).getMessagesCount());
 publisher.shutdown();
 publisher.awaitTermination(1, TimeUnit.MINUTES);
}
origin: googleapis/google-cloud-java

assertEquals(2, testPublisherServiceImpl.getCapturedRequests().get(0).getMessagesCount());
assertEquals(1, testPublisherServiceImpl.getCapturedRequests().get(1).getMessagesCount());
publisher.shutdown();
publisher.awaitTermination(1, TimeUnit.MINUTES);
origin: googleapis/google-cloud-java

@Test
public void testPublishByDuration() throws Exception {
 Publisher publisher =
   getTestPublisherBuilder()
     // To demonstrate that reaching duration will trigger publish
     .setBatchingSettings(
       Publisher.Builder.DEFAULT_BATCHING_SETTINGS
         .toBuilder()
         .setDelayThreshold(Duration.ofSeconds(5))
         .setElementCountThreshold(10L)
         .build())
     .build();
 testPublisherServiceImpl.addPublishResponse(
   PublishResponse.newBuilder().addMessageIds("1").addMessageIds("2"));
 ApiFuture<String> publishFuture1 = sendTestMessage(publisher, "A");
 ApiFuture<String> publishFuture2 = sendTestMessage(publisher, "B");
 assertFalse(publishFuture1.isDone());
 assertFalse(publishFuture2.isDone());
 fakeExecutor.advanceTime(Duration.ofSeconds(10));
 assertEquals("1", publishFuture1.get());
 assertEquals("2", publishFuture2.get());
 assertEquals(2, testPublisherServiceImpl.getCapturedRequests().get(0).getMessagesCount());
 publisher.shutdown();
 publisher.awaitTermination(1, TimeUnit.MINUTES);
}
origin: com.google.api.grpc/proto-google-cloud-pubsub-v1

@java.lang.Override
public int hashCode() {
 if (memoizedHashCode != 0) {
  return memoizedHashCode;
 }
 int hash = 41;
 hash = (19 * hash) + getDescriptor().hashCode();
 hash = (37 * hash) + TOPIC_FIELD_NUMBER;
 hash = (53 * hash) + getTopic().hashCode();
 if (getMessagesCount() > 0) {
  hash = (37 * hash) + MESSAGES_FIELD_NUMBER;
  hash = (53 * hash) + getMessagesList().hashCode();
 }
 hash = (29 * hash) + unknownFields.hashCode();
 memoizedHashCode = hash;
 return hash;
}
origin: com.google.api.grpc/grpc-google-pubsub-v1

@java.lang.Override
public int hashCode() {
 if (memoizedHashCode != 0) {
  return memoizedHashCode;
 }
 int hash = 41;
 hash = (19 * hash) + getDescriptorForType().hashCode();
 hash = (37 * hash) + TOPIC_FIELD_NUMBER;
 hash = (53 * hash) + getTopic().hashCode();
 if (getMessagesCount() > 0) {
  hash = (37 * hash) + MESSAGES_FIELD_NUMBER;
  hash = (53 * hash) + getMessagesList().hashCode();
 }
 hash = (29 * hash) + unknownFields.hashCode();
 memoizedHashCode = hash;
 return hash;
}
com.google.pubsub.v1PublishRequestgetMessagesCount

Javadoc

 
The messages to publish. 
repeated .google.pubsub.v1.PubsubMessage messages = 2;

Popular methods of PublishRequest

  • newBuilder
  • getTopic
    The messages in the request will be published on this topic. optional string topic = 1;
  • getDefaultInstance
  • <init>
  • getMessagesList
    The messages to publish. repeated .google.pubsub.v1.PubsubMessage messages = 2;
  • getTopicBytes
    The messages in the request will be published on this topic. optional string topic = 1;
  • isInitialized
  • makeExtensionsImmutable
  • toBuilder
  • getDescriptor
  • getDescriptorForType
  • getSerializedSize
  • getDescriptorForType,
  • getSerializedSize,
  • parseUnknownFieldProto3

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Path (java.nio.file)
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Reference (javax.naming)
  • JButton (javax.swing)
  • Best IntelliJ plugins
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