Send feedback
  
   
 
  
    
      Class PubSubMessage (1.15.17) 
  
  
  
   
  
    
  
  
    
    
    
    
    
  Version latestkeyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   final   class  PubSubMessage   extends   GeneratedMessageV3   implements   PubSubMessageOrBuilder  
   A message that is published by publishers and delivered to subscribers.
 Protobuf type google.cloud.pubsublite.v1.PubSubMessage
    Inherited Members 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT) 
    
    
      com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int) 
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>) 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int) 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
   
  Static Fields
   
  ATTRIBUTES_FIELD_NUMBER 
  
    
public   static   final   int   ATTRIBUTES_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  DATA_FIELD_NUMBER 
  
    
public   static   final   int   DATA_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  EVENT_TIME_FIELD_NUMBER 
  
    
public   static   final   int   EVENT_TIME_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  KEY_FIELD_NUMBER 
  
    
public   static   final   int   KEY_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  Static Methods
   
  getDefaultInstance() 
  
    
public   static   PubSubMessage   getDefaultInstance ()  
  
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
  
  newBuilder() 
  
    
public   static   PubSubMessage . Builder   newBuilder ()  
  
  newBuilder(PubSubMessage prototype) 
  
    
public   static   PubSubMessage . Builder   newBuilder ( PubSubMessage   prototype )  
  
  
  
    
public   static   PubSubMessage   parseDelimitedFrom ( InputStream   input )  
  
  
  
  
    
public   static   PubSubMessage   parseDelimitedFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parseFrom(byte[] data) 
  
    
public   static   PubSubMessage   parseFrom ( byte []   data )  
  
    
      
        Parameter  
      
        Name Description  
      
        databyte [] 
     
  
  
  
  parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   PubSubMessage   parseFrom ( byte []   data ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parseFrom(ByteString data) 
  
    
public   static   PubSubMessage   parseFrom ( ByteString   data )  
  
  
  
  parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   PubSubMessage   parseFrom ( ByteString   data ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  
    
public   static   PubSubMessage   parseFrom ( CodedInputStream   input )  
  
  
  
  
    
public   static   PubSubMessage   parseFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  
    
public   static   PubSubMessage   parseFrom ( InputStream   input )  
  
  
  
  
    
public   static   PubSubMessage   parseFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parseFrom(ByteBuffer data) 
  
    
public   static   PubSubMessage   parseFrom ( ByteBuffer   data )  
  
  
  
  parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   PubSubMessage   parseFrom ( ByteBuffer   data ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parser() 
  
    
public   static   Parser<PubSubMessage>   parser ()  
  
  Methods
   
  containsAttributes(String key) 
  
    
public   boolean   containsAttributes ( String   key )  
   Optional attributes that can be used for message metadata/headers.
 map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;
    
      
        Parameter  
      
        Name Description  
      
        keyString  
     
  
  
  equals(Object obj) 
  
    
public   boolean   equals ( Object   obj )  
  
    
      
        Parameter  
      
        Name Description  
      
        objObject  
     
  
  
  Overrides 
  
  getAttributes() (deprecated) 
  
    
public   Map<String , AttributeValues >  getAttributes ()  
  
  
  getAttributesCount() 
  
    
public   int   getAttributesCount ()  
   Optional attributes that can be used for message metadata/headers.
 map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;
    
      
        Returns  
      
        Type Description  
      
        int  
     
  
  getAttributesMap() 
  
    
public   Map<String , AttributeValues >  getAttributesMap ()  
   Optional attributes that can be used for message metadata/headers.
 map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;
getAttributesOrDefault(String key, AttributeValues defaultValue) 
  
    
public   AttributeValues   getAttributesOrDefault ( String   key ,   AttributeValues   defaultValue )  
   Optional attributes that can be used for message metadata/headers.
 map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;
getAttributesOrThrow(String key) 
  
    
public   AttributeValues   getAttributesOrThrow ( String   key )  
   Optional attributes that can be used for message metadata/headers.
 map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;
    
      
        Parameter  
      
        Name Description  
      
        keyString  
     
  
  
  getData() 
  
    
public   ByteString   getData ()  
   The payload of the message.
 bytes data = 2;
getDefaultInstanceForType() 
  
    
public   PubSubMessage   getDefaultInstanceForType ()  
  
  getEventTime() 
  
    
public   Timestamp   getEventTime ()  
   An optional, user-specified event time.
 .google.protobuf.Timestamp event_time = 4;
    
      
        Returns  
      
        Type Description  
      
        Timestamp The eventTime.
 
     
  
  getEventTimeOrBuilder() 
  
    
public   TimestampOrBuilder   getEventTimeOrBuilder ()  
   An optional, user-specified event time.
 .google.protobuf.Timestamp event_time = 4;
getKey() 
  
    
public   ByteString   getKey ()  
   The key used for routing messages to partitions or for compaction (e.g.,
 keep the last N messages per key). If the key is empty, the message is
 routed to an arbitrary partition.
 bytes key = 1;
getParserForType() 
  
    
public   Parser<PubSubMessage>   getParserForType ()  
  
  Overrides 
  
  getSerializedSize() 
  
    
public   int   getSerializedSize ()  
  
    
      
        Returns  
      
        Type Description  
      
        int  
     
  
  Overrides 
  
  hasEventTime() 
  
    
public   boolean   hasEventTime ()  
   An optional, user-specified event time.
 .google.protobuf.Timestamp event_time = 4;
    
      
        Returns  
      
        Type Description  
      
        boolean Whether the eventTime field is set.
 
     
  
  hashCode() 
  
  
    
      
        Returns  
      
        Type Description  
      
        int  
     
  
  Overrides 
  
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
  
  Overrides 
  
  internalGetMapFieldReflection(int number) 
  
    
protected   MapFieldReflectionAccessor   internalGetMapFieldReflection ( int   number )  
  
    
      
        Parameter  
      
        Name Description  
      
        numberint  
     
  
  
    
      
        Returns  
      
        Type Description  
      
        com.google.protobuf.MapFieldReflectionAccessor  
     
  
  Overrides 
  com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int) 
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
  
  Overrides 
  
  newBuilderForType() 
  
    
public   PubSubMessage . Builder   newBuilderForType ()  
  
  newBuilderForType(GeneratedMessageV3.BuilderParent parent) 
  
    
protected   PubSubMessage . Builder   newBuilderForType ( GeneratedMessageV3 . BuilderParent   parent )  
  
  
  Overrides 
  
  newInstance(GeneratedMessageV3.UnusedPrivateParameter unused) 
  
    
protected   Object   newInstance ( GeneratedMessageV3 . UnusedPrivateParameter   unused )  
  
  
    
      
        Returns  
      
        Type Description  
      
        Object  
     
  
  Overrides 
  
  toBuilder() 
  
    
public   PubSubMessage . Builder   toBuilder ()  
  
  writeTo(CodedOutputStream output) 
  
    
public   void   writeTo ( CodedOutputStream   output )  
  
  Overrides 
  
  
 
     
    
  
  
  
     
  
    
    
      
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-11 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-11 UTC."],[],[]]