接口的使用
org.apache.pulsar.client.api.Schema
-
使用Schema的程序包 程序包 说明 org.apache.pulsar.client.api Pulsar Client API.org.apache.pulsar.client.api.schema Schema definitions for Pulsar Client API.org.apache.pulsar.client.internal Helpers which provide useful functionality for the implementation of Pulsar Client API.org.apache.pulsar.common.schema This package contains data structures for schema definitions used in the Pulsar Client API. -
-
org.apache.pulsar.client.api中Schema的使用
声明为Schema的org.apache.pulsar.client.api中的字段 修饰符和类型 字段 说明 static Schema<java.lang.Boolean>Schema. BOOLBoolean Schema.static Schema<java.nio.ByteBuffer>Schema. BYTEBUFFERByteBuffer Schema.static Schema<byte[]>Schema. BYTESSchema that doesn't perform any encoding on the message payloads.static Schema<java.util.Date>Schema. DATEDate Schema.static Schema<java.lang.Double>Schema. DOUBLEDouble Schema.static Schema<java.lang.Float>Schema. FLOATFloat Schema.static Schema<java.time.Instant>Schema. INSTANTInstant Schema.static Schema<java.lang.Short>Schema. INT16INT16 Schema.static Schema<java.lang.Integer>Schema. INT32INT32 Schema.static Schema<java.lang.Long>Schema. INT64INT64 Schema.static Schema<java.lang.Byte>Schema. INT8INT8 Schema.static Schema<java.time.LocalDate>Schema. LOCAL_DATELocalDate Schema.static Schema<java.time.LocalDateTime>Schema. LOCAL_DATE_TIMELocalDateTime Schema.static Schema<java.time.LocalTime>Schema. LOCAL_TIMELocalTime Schema.static Schema<java.lang.String>Schema. STRINGSchema that can be used to encode/decode messages whose values are String.static Schema<java.sql.Time>Schema. TIMETime Schema.static Schema<java.sql.Timestamp>Schema. TIMESTAMPTimestamp Schema.返回Schema的org.apache.pulsar.client.api中的方法 修饰符和类型 方法 说明 static Schema<GenericRecord>Schema. AUTO()已过时。static Schema<GenericRecord>Schema. AUTO_CONSUME()Create a schema instance that automatically deserialize messages based on the current topic schema.static Schema<byte[]>Schema. AUTO_PRODUCE_BYTES()Create a schema instance that accepts a serialized payload and validates it against the topic schema.static Schema<byte[]>Schema. AUTO_PRODUCE_BYTES(Schema<?> schema)Create a schema instance that accepts a serialized payload and validates it against the schema specified.static <T> Schema<T>Schema. AVRO(java.lang.Class<T> pojo)Create a Avro schema type by default configuration of the class.static <T> Schema<T>Schema. AVRO(SchemaDefinition<T> schemaDefinition)Create a Avro schema type with schema definition.Schema<T>Schema. clone()Duplicates the schema.static Schema<?>Schema. getSchema(SchemaInfo schemaInfo)static <T> Schema<T>Schema. JSON(java.lang.Class<T> pojo)Create a JSON schema type by extracting the fields of the specified class.static <T> Schema<T>Schema. JSON(SchemaDefinition schemaDefinition)Create a JSON schema type with schema definition.static <K,V>
Schema<KeyValue<K,V>>Schema. KeyValue(java.lang.Class<K> key, java.lang.Class<V> value)Key Value Schema whose underneath key and value schemas are JSONSchema.static <K,V>
Schema<KeyValue<K,V>>Schema. KeyValue(java.lang.Class<K> key, java.lang.Class<V> value, SchemaType type)Key Value Schema using passed in schema type, support JSON and AVRO currently.static <K,V>
Schema<KeyValue<K,V>>Schema. KeyValue(Schema<K> key, Schema<V> value)Key Value Schema using passed in key and value schemas.static <K,V>
Schema<KeyValue<K,V>>Schema. KeyValue(Schema<K> key, Schema<V> value, KeyValueEncodingType keyValueEncodingType)Key Value Schema using passed in key, value and encoding type schemas.static Schema<KeyValue<byte[],byte[]>>Schema. KV_BYTES()Schema that can be used to encode/decode KeyValue.static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>Schema. PROTOBUF(java.lang.Class<T> clazz)Create a Protobuf schema type by extracting the fields of the specified class.static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>Schema. PROTOBUF(SchemaDefinition<T> schemaDefinition)Create a Protobuf schema type with schema definition.static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>Schema. PROTOBUF_NATIVE(java.lang.Class<T> clazz)Create a Protobuf-Native schema type by extracting the fields of the specified class.static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>Schema. PROTOBUF_NATIVE(SchemaDefinition<T> schemaDefinition)Create a Protobuf-Native schema type with schema definition.返回变量类型为Schema的类型的org.apache.pulsar.client.api中的方法 修饰符和类型 方法 说明 default java.util.Optional<Schema<?>>Message. getReaderSchema()Get the schema associated to the message.参数类型为Schema的org.apache.pulsar.client.api中的方法 修饰符和类型 方法 说明 static Schema<byte[]>Schema. AUTO_PRODUCE_BYTES(Schema<?> schema)Create a schema instance that accepts a serialized payload and validates it against the schema specified.static <K,V>
Schema<KeyValue<K,V>>Schema. KeyValue(Schema<K> key, Schema<V> value)Key Value Schema using passed in key and value schemas.static <K,V>
Schema<KeyValue<K,V>>Schema. KeyValue(Schema<K> key, Schema<V> value, KeyValueEncodingType keyValueEncodingType)Key Value Schema using passed in key, value and encoding type schemas.<T> ConsumerBuilder<T>PulsarClient. newConsumer(Schema<T> schema)Create a consumer builder with a specific schema for subscribing on a specific topic<V> TypedMessageBuilder<V>Producer. newMessage(Schema<V> schema)Create a new message builder with schema, not required same parameterized type with the producer.<T> ProducerBuilder<T>PulsarClient. newProducer(Schema<T> schema)Create a producer builder that can be used to configure and construct a producer with the specified schema.<T> ReaderBuilder<T>PulsarClient. newReader(Schema<T> schema)Create a topic reader builder with a specificSchema) to read from the specified topic. -
org.apache.pulsar.client.api.schema中Schema的使用
org.apache.pulsar.client.api.schema中Schema的子接口 修饰符和类型 接口 说明 interfaceGenericSchema<T extends GenericRecord>A schema that serializes and deserializes betweenGenericRecordand bytes.interfaceKeyValueSchema<K,V>This interface models a Schema that is composed of two parts.返回Schema的org.apache.pulsar.client.api.schema中的方法 修饰符和类型 方法 说明 Schema<K>KeyValueSchema. getKeySchema()Get the Schema of the Key.Schema<V>KeyValueSchema. getValueSchema()Get the Schema of the Value. -
org.apache.pulsar.client.internal中Schema的使用
返回Schema的org.apache.pulsar.client.internal中的方法 修饰符和类型 方法 说明 static Schema<?>DefaultImplementation. getSchema(SchemaInfo schemaInfo)static Schema<GenericRecord>DefaultImplementation. newAutoConsumeSchema()static Schema<byte[]>DefaultImplementation. newAutoProduceSchema()static Schema<byte[]>DefaultImplementation. newAutoProduceSchema(Schema<?> schema)static <T> Schema<T>DefaultImplementation. newAvroSchema(SchemaDefinition schemaDefinition)static Schema<java.lang.Boolean>DefaultImplementation. newBooleanSchema()static Schema<java.nio.ByteBuffer>DefaultImplementation. newByteBufferSchema()static Schema<java.lang.Byte>DefaultImplementation. newByteSchema()static Schema<byte[]>DefaultImplementation. newBytesSchema()static Schema<java.util.Date>DefaultImplementation. newDateSchema()static Schema<java.lang.Double>DefaultImplementation. newDoubleSchema()static Schema<java.lang.Float>DefaultImplementation. newFloatSchema()static Schema<java.time.Instant>DefaultImplementation. newInstantSchema()static Schema<java.lang.Integer>DefaultImplementation. newIntSchema()static <T> Schema<T>DefaultImplementation. newJSONSchema(SchemaDefinition schemaDefinition)static Schema<KeyValue<byte[],byte[]>>DefaultImplementation. newKeyValueBytesSchema()static <K,V>
Schema<KeyValue<K,V>>DefaultImplementation. newKeyValueSchema(java.lang.Class<K> key, java.lang.Class<V> value, SchemaType type)static <K,V>
Schema<KeyValue<K,V>>DefaultImplementation. newKeyValueSchema(Schema<K> keySchema, Schema<V> valueSchema)static <K,V>
Schema<KeyValue<K,V>>DefaultImplementation. newKeyValueSchema(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType)static Schema<java.time.LocalDate>DefaultImplementation. newLocalDateSchema()static Schema<java.time.LocalDateTime>DefaultImplementation. newLocalDateTimeSchema()static Schema<java.time.LocalTime>DefaultImplementation. newLocalTimeSchema()static Schema<java.lang.Long>DefaultImplementation. newLongSchema()static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>DefaultImplementation. newProtobufNativeSchema(SchemaDefinition schemaDefinition)static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>DefaultImplementation. newProtobufSchema(SchemaDefinition schemaDefinition)static Schema<java.lang.Short>DefaultImplementation. newShortSchema()static Schema<java.lang.String>DefaultImplementation. newStringSchema()static Schema<java.lang.String>DefaultImplementation. newStringSchema(java.nio.charset.Charset charset)static Schema<java.sql.Time>DefaultImplementation. newTimeSchema()static Schema<java.sql.Timestamp>DefaultImplementation. newTimestampSchema()参数类型为Schema的org.apache.pulsar.client.internal中的方法 修饰符和类型 方法 说明 static <K,V>
SchemaInfoDefaultImplementation. encodeKeyValueSchemaInfo(java.lang.String schemaName, Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType)Encode key & value into schema into a KeyValue schema.static <K,V>
SchemaInfoDefaultImplementation. encodeKeyValueSchemaInfo(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType)Encode key & value into schema into a KeyValue schema.static Schema<byte[]>DefaultImplementation. newAutoProduceSchema(Schema<?> schema)static <K,V>
Schema<KeyValue<K,V>>DefaultImplementation. newKeyValueSchema(Schema<K> keySchema, Schema<V> valueSchema)static <K,V>
Schema<KeyValue<K,V>>DefaultImplementation. newKeyValueSchema(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) -
org.apache.pulsar.common.schema中Schema的使用
参数类型为Schema的org.apache.pulsar.common.schema中的方法 修饰符和类型 方法 说明 static <K,V>
byte[]KeyValue. encode(K key, Schema<K> keyWriter, V value, Schema<V> valueWriter)Encode a key and value pair into a bytes array.
-