public class PulsarPrimitiveSchema<T> extends Object implements PulsarSerializationSchema<T>, PulsarDeserializationSchema<T>, PulsarContextAware<T>
| Constructor and Description |
|---|
PulsarPrimitiveSchema(Class<T> recordClazz) |
| Modifier and Type | Method and Description |
|---|---|
T |
deserialize(org.apache.pulsar.client.api.Message<T> message)
Deserializes the Pulsar message.
|
org.apache.flink.api.common.typeinfo.TypeInformation<T> |
getProducedType() |
org.apache.pulsar.client.api.Schema<T> |
getSchema() |
Optional<String> |
getTargetTopic(T element)
Returns the topic that the presented element should be sent to.
|
boolean |
isEndOfStream(T nextElement)
Method to decide whether the element signals the end of the stream.
|
static boolean |
isPulsarPrimitive(Class<?> key) |
void |
serialize(T element,
org.apache.pulsar.client.api.TypedMessageBuilder<T> messageBuilder)
Serializes the incoming element to a specified type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitopenbuilder, deserialize, open, valueOnlysetNumParallelInstances, setParallelInstanceIdpublic static boolean isPulsarPrimitive(Class<?> key)
public void serialize(T element, org.apache.pulsar.client.api.TypedMessageBuilder<T> messageBuilder)
PulsarSerializationSchemaserialize in interface PulsarSerializationSchema<T>element - The incoming element to be serializedpublic T deserialize(org.apache.pulsar.client.api.Message<T> message) throws IOException
PulsarDeserializationSchemaCan output multiple records through the Collector. Note that number and size of the
produced records should be relatively small. Depending on the source implementation records
can be buffered in memory or collecting records might delay emitting checkpoint barrier.
deserialize in interface PulsarDeserializationSchema<T>message - The message, as a byte array.IOExceptionpublic Optional<String> getTargetTopic(T element)
PulsarContextAwaregetTargetTopic in interface PulsarContextAware<T>public org.apache.pulsar.client.api.Schema<T> getSchema()
getSchema in interface PulsarContextAware<T>public org.apache.flink.api.common.typeinfo.TypeInformation<T> getProducedType()
getProducedType in interface org.apache.flink.api.java.typeutils.ResultTypeQueryable<T>public boolean isEndOfStream(T nextElement)
PulsarDeserializationSchemaisEndOfStream in interface PulsarDeserializationSchema<T>nextElement - The element to test for the end-of-stream signal.Copyright © 2019–2022 The Apache Software Foundation. All rights reserved.