@Override public PartitionKey getBatchPartitionKey(PublishRequest request) { return new PartitionKey(request.getTopic()); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.PublishRequest)) { return super.equals(obj); } com.google.pubsub.v1.PublishRequest other = (com.google.pubsub.v1.PublishRequest) obj; boolean result = true; result = result && getTopic().equals(other.getTopic()); result = result && getMessagesList().equals(other.getMessagesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@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; }
/** * * * <pre> * The messages in the request will be published on this topic. * Format is `projects/{project}/topics/{topic}`. * </pre> * * <code>string topic = 1;</code> */ public Builder clearTopic() { topic_ = getDefaultInstance().getTopic(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.pubsub.v1.PublishRequest other) { if (other == com.google.pubsub.v1.PublishRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged();
@Test @SuppressWarnings("all") public void publishTest() { String messageIdsElement = "messageIdsElement-744837059"; List<String> messageIds = Arrays.asList(messageIdsElement); PublishResponse expectedResponse = PublishResponse.newBuilder().addAllMessageIds(messageIds).build(); mockPublisher.addResponse(expectedResponse); ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); ByteString data = ByteString.copyFromUtf8("-86"); PubsubMessage messagesElement = PubsubMessage.newBuilder().setData(data).build(); List<PubsubMessage> messages = Arrays.asList(messagesElement); PublishResponse actualResponse = client.publish(topic, messages); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); PublishRequest actualRequest = (PublishRequest) actualRequests.get(0); Assert.assertEquals(topic, ProjectTopicName.parse(actualRequest.getTopic())); Assert.assertEquals(messages, actualRequest.getMessagesList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.PublishRequest)) { return super.equals(obj); } com.google.pubsub.v1.PublishRequest other = (com.google.pubsub.v1.PublishRequest) obj; boolean result = true; result = result && getTopic().equals(other.getTopic()); result = result && getMessagesList().equals(other.getMessagesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.PublishRequest)) { return super.equals(obj); } com.google.pubsub.v1.PublishRequest other = (com.google.pubsub.v1.PublishRequest) obj; boolean result = true; result = result && getTopic() .equals(other.getTopic()); result = result && getMessagesList() .equals(other.getMessagesList()); return result; }
@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; }
/** * <pre> * The messages in the request will be published on this topic. * </pre> * * <code>optional string topic = 1;</code> */ public Builder clearTopic() { topic_ = getDefaultInstance().getTopic(); onChanged(); return this; } /**
/** * * * <pre> * The messages in the request will be published on this topic. * Format is `projects/{project}/topics/{topic}`. * </pre> * * <code>string topic = 1;</code> */ public Builder clearTopic() { topic_ = getDefaultInstance().getTopic(); onChanged(); return this; } /**
@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; }
/** * <code>optional string topic = 1;</code> * * <pre> * The messages in the request will be published on this topic. * </pre> */ public Builder clearTopic() { topic_ = getDefaultInstance().getTopic(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.pubsub.v1.PublishRequest other) { if (other == com.google.pubsub.v1.PublishRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged();
public Builder mergeFrom(com.google.pubsub.v1.PublishRequest other) { if (other == com.google.pubsub.v1.PublishRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged();
public Builder mergeFrom(com.google.pubsub.v1.PublishRequest other) { if (other == com.google.pubsub.v1.PublishRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged();