接口的使用
org.apache.pulsar.client.api.Schema
使用Schema的程序包
程序包
说明
Pulsar Client API.
Schema definitions for Pulsar Client API.
Helpers which provide useful functionality for the implementation of Pulsar Client API.
This package contains data structures for schema definitions used in the Pulsar Client API.
-
org.apache.pulsar.client.api中Schema的使用
修饰符和类型字段说明Schema.BOOL
Boolean Schema.static final Schema<ByteBuffer>
Schema.BYTEBUFFER
ByteBuffer Schema.static final Schema<byte[]>
Schema.BYTES
Schema that doesn't perform any encoding on the message payloads.Schema.DATE
Date Schema.Schema.DOUBLE
Double Schema.Schema.FLOAT
Float Schema.Schema.INSTANT
Instant Schema.Schema.INT16
INT16 Schema.Schema.INT32
INT32 Schema.Schema.INT64
INT64 Schema.Schema.INT8
INT8 Schema.Schema.LOCAL_DATE
LocalDate Schema.static final Schema<LocalDateTime>
Schema.LOCAL_DATE_TIME
LocalDateTime Schema.Schema.LOCAL_TIME
LocalTime Schema.Schema.STRING
Schema that can be used to encode/decode messages whose values are String.Schema.TIME
Time Schema.Schema.TIMESTAMP
Timestamp Schema.修饰符和类型方法说明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>
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.clone()
Duplicates the schema.static Schema<?>
Schema.getSchema
(SchemaInfo schemaInfo) static <T> Schema<T>
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.Key Value Schema whose underneath key and value schemas are JSONSchema.Schema.KeyValue
(Class<K> key, Class<V> value, SchemaType type) Key Value Schema using passed in schema type, support JSON and AVRO currently.Key Value Schema using passed in key and value schemas withKeyValueEncodingType.INLINE
encoding type.Schema.KeyValue
(Schema<K> key, Schema<V> value, KeyValueEncodingType keyValueEncodingType) Key Value Schema using passed in key, value and encoding type schemas.Schema.KV_BYTES()
Schema that can be used to encode/decode KeyValue.static Schema<byte[]>
Schema.NATIVE_AVRO
(Object schema) Create a schema instance that accepts a serialized Avro payload without validating it against the schema specified.static <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>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
(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中的方法参数类型为Schema的org.apache.pulsar.client.api中的方法修饰符和类型方法说明<T> Message<T>
MessagePayloadContext.asSingleMessage
(MessagePayload payload, Schema<T> schema) Convert the given payload to a single message if the entry is not a batch.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.<T> Message<T>
MessagePayloadContext.getMessageAt
(int index, int numMessages, MessagePayload payload, boolean containMetadata, Schema<T> schema) Get the internal single message with a specific index from a payload if the payload is a batch.Key Value Schema using passed in key and value schemas withKeyValueEncodingType.INLINE
encoding type.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>
Create a topic reader builder with a specificSchema
) to read from the specified topic.<T> TableViewBuilder<T>
PulsarClient.newTableViewBuilder
(Schema<T> schema) Create a table view builder with a specific schema for subscribing on a specific topic.<T> void
MessagePayloadProcessor.process
(MessagePayload payload, MessagePayloadContext context, Schema<T> schema, Consumer<Message<T>> messageConsumer) Process the message payload. -
org.apache.pulsar.client.api.schema中Schema的使用
修饰符和类型接口说明interface
GenericSchema<T extends GenericRecord>
A schema that serializes and deserializes betweenGenericRecord
and bytes.interface
KeyValueSchema<K,
V> This interface models a Schema that is composed of two parts.修饰符和类型方法说明KeyValueSchema.getKeySchema()
Get the Schema of the Key.KeyValueSchema.getValueSchema()
Get the Schema of the Value. -
org.apache.pulsar.client.internal中Schema的使用
修饰符和类型方法说明Schema<?>
PulsarClientImplementationBinding.getSchema
(SchemaInfo schemaInfo) PulsarClientImplementationBinding.newAutoConsumeSchema()
Schema<byte[]>
PulsarClientImplementationBinding.newAutoProduceSchema()
Schema<byte[]>
PulsarClientImplementationBinding.newAutoProduceSchema
(Schema<?> schema) Schema<byte[]>
PulsarClientImplementationBinding.newAutoProduceValidatedAvroSchema
(Object schema) <T> Schema<T>
PulsarClientImplementationBinding.newAvroSchema
(SchemaDefinition schemaDefinition) PulsarClientImplementationBinding.newBooleanSchema()
PulsarClientImplementationBinding.newByteBufferSchema()
PulsarClientImplementationBinding.newByteSchema()
Schema<byte[]>
PulsarClientImplementationBinding.newBytesSchema()
PulsarClientImplementationBinding.newDateSchema()
PulsarClientImplementationBinding.newDoubleSchema()
PulsarClientImplementationBinding.newFloatSchema()
PulsarClientImplementationBinding.newInstantSchema()
PulsarClientImplementationBinding.newIntSchema()
<T> Schema<T>
PulsarClientImplementationBinding.newJSONSchema
(SchemaDefinition schemaDefinition) PulsarClientImplementationBinding.newKeyValueBytesSchema()
PulsarClientImplementationBinding.newKeyValueSchema
(Class<K> key, Class<V> value, SchemaType type) PulsarClientImplementationBinding.newKeyValueSchema
(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) PulsarClientImplementationBinding.newLocalDateSchema()
PulsarClientImplementationBinding.newLocalDateTimeSchema()
PulsarClientImplementationBinding.newLocalTimeSchema()
PulsarClientImplementationBinding.newLongSchema()
<T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>PulsarClientImplementationBinding.newProtobufNativeSchema
(SchemaDefinition schemaDefinition) <T extends com.google.protobuf.GeneratedMessageV3>
Schema<T>PulsarClientImplementationBinding.newProtobufSchema
(SchemaDefinition schemaDefinition) PulsarClientImplementationBinding.newShortSchema()
PulsarClientImplementationBinding.newStringSchema()
PulsarClientImplementationBinding.newStringSchema
(Charset charset) PulsarClientImplementationBinding.newTimeSchema()
PulsarClientImplementationBinding.newTimestampSchema()
参数类型为Schema的org.apache.pulsar.client.internal中的方法修饰符和类型方法说明<K,
V> SchemaInfo PulsarClientImplementationBinding.encodeKeyValueSchemaInfo
(String schemaName, Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) Encode key & value into schema into a KeyValue schema.<K,
V> SchemaInfo PulsarClientImplementationBinding.encodeKeyValueSchemaInfo
(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) Encode key & value into schema into a KeyValue schema.Schema<byte[]>
PulsarClientImplementationBinding.newAutoProduceSchema
(Schema<?> schema) PulsarClientImplementationBinding.newKeyValueSchema
(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) -
org.apache.pulsar.common.schema中Schema的使用
参数类型为Schema的org.apache.pulsar.common.schema中的方法