| 程序包 | 说明 |
|---|---|
| org.apache.pulsar.client.api | |
| org.apache.pulsar.client.api.schema | |
| org.apache.pulsar.client.internal | |
| org.apache.pulsar.common.schema |
| 限定符和类型 | 字段和说明 |
|---|---|
static Schema<Boolean> |
Schema.BOOL
Boolean Schema
|
static Schema<ByteBuffer> |
Schema.BYTEBUFFER
ByteBuffer Schema.
|
static Schema<byte[]> |
Schema.BYTES
Schema that doesn't perform any encoding on the message payloads.
|
static Schema<Date> |
Schema.DATE
Date Schema
|
static Schema<Double> |
Schema.DOUBLE
Double Schema
|
static Schema<Float> |
Schema.FLOAT
Float Schema
|
static Schema<Short> |
Schema.INT16
INT16 Schema
|
static Schema<Integer> |
Schema.INT32
INT32 Schema
|
static Schema<Long> |
Schema.INT64
INT64 Schema
|
static Schema<Byte> |
Schema.INT8
INT8 Schema
|
static Schema<String> |
Schema.STRING
Schema that can be used to encode/decode messages whose values are String.
|
static Schema<Time> |
Schema.TIME
Time Schema
|
static Schema<Timestamp> |
Schema.TIMESTAMP
Timestamp Schema
|
| 限定符和类型 | 方法和说明 |
|---|---|
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<GenericRecord> |
Schema.AUTO()
已过时。
|
static <T> Schema<T> |
Schema.AVRO(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
|
static Schema<?> |
Schema.getSchema(SchemaInfo schemaInfo) |
static <T> Schema<T> |
Schema.JSON(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(Class<K> key,
Class<V> value)
Key Value Schema whose underneath key and value schemas are JSONSchema.
|
static <K,V> Schema<KeyValue<K,V>> |
Schema.KeyValue(Class<K> key,
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.PROTOBUF(Class<T> clazz)
Create a Protobuf schema type by extracting the fields of the specified class.
|
static <T extends com.google.protobuf.GeneratedMessageV3> |
Schema.PROTOBUF(SchemaDefinition<T> schemaDefinition)
Create a Protobuf schema type with schema definition.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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)
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 <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
Since 2.2, if you are creating a consumer with non-bytes schema on a non-existence topic, it will
automatically create the topic with the provided schema.
|
<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
Example:
Producer<String> producer = client.newProducer(Schema.STRING)
.topic("my-topic")
.create();
producer.send("test");
|
<T> ReaderBuilder<T> |
PulsarClient.newReader(Schema<T> schema)
Create a topic reader builder with a specific
Schema) to read from the specified topic. |
| 限定符和类型 | 接口和说明 |
|---|---|
interface |
GenericSchema<T extends GenericRecord>
A schema that serializes and deserializes between
GenericRecord and bytes. |
| 限定符和类型 | 方法和说明 |
|---|---|
static Schema<?> |
DefaultImplementation.getSchema(SchemaInfo schemaInfo) |
static Schema<GenericRecord> |
DefaultImplementation.newAutoConsumeSchema() |
static Schema<byte[]> |
DefaultImplementation.newAutoProduceSchema() |
static <T> Schema<T> |
DefaultImplementation.newAvroSchema(SchemaDefinition schemaDefinition) |
static Schema<Boolean> |
DefaultImplementation.newBooleanSchema() |
static Schema<ByteBuffer> |
DefaultImplementation.newByteBufferSchema() |
static Schema<Byte> |
DefaultImplementation.newByteSchema() |
static Schema<byte[]> |
DefaultImplementation.newBytesSchema() |
static Schema<Date> |
DefaultImplementation.newDateSchema() |
static Schema<Double> |
DefaultImplementation.newDoubleSchema() |
static Schema<Float> |
DefaultImplementation.newFloatSchema() |
static Schema<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(Class<K> key,
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<Long> |
DefaultImplementation.newLongSchema() |
static <T extends com.google.protobuf.GeneratedMessageV3> |
DefaultImplementation.newProtobufSchema(SchemaDefinition schemaDefinition) |
static Schema<Short> |
DefaultImplementation.newShortSchema() |
static Schema<String> |
DefaultImplementation.newStringSchema() |
static Schema<String> |
DefaultImplementation.newStringSchema(Charset charset) |
static Schema<Time> |
DefaultImplementation.newTimeSchema() |
static Schema<Timestamp> |
DefaultImplementation.newTimestampSchema() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <K,V> SchemaInfo |
DefaultImplementation.encodeKeyValueSchemaInfo(Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType)
Encode key & value into schema into a KeyValue schema.
|
static <K,V> SchemaInfo |
DefaultImplementation.encodeKeyValueSchemaInfo(Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType)
Encode key & value into schema into a KeyValue schema.
|
static <K,V> SchemaInfo |
DefaultImplementation.encodeKeyValueSchemaInfo(String schemaName,
Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType)
Encode key & value into schema into a KeyValue schema.
|
static <K,V> SchemaInfo |
DefaultImplementation.encodeKeyValueSchemaInfo(String schemaName,
Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType)
Encode key & value into schema into a KeyValue 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) |
static <K,V> Schema<KeyValue<K,V>> |
DefaultImplementation.newKeyValueSchema(Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType) |
static <K,V> Schema<KeyValue<K,V>> |
DefaultImplementation.newKeyValueSchema(Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType) |
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
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.
|
Copyright © 2017–2019 Apache Software Foundation. All rights reserved.