public class AtLeastOnceProcessor extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.pulsar.client.api.PulsarClient |
client |
protected org.apache.pulsar.functions.proto.Function.FunctionDetails |
functionDetails |
protected Source |
source |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
initializeOutputProducer(String outputTopic) |
void |
postReceiveMessage(Record record)
Method called when a message is received from input after being put into the process queue.
|
Record |
recieveMessage()
Get the next message to process
|
void |
sendOutputMessage(Record srcRecord,
org.apache.pulsar.client.api.MessageBuilder outputMsgBuilder)
Send the output message to the output topic.
|
void |
setupInput(Class<?> inputType)
Setup the source.
|
void |
setupOutput(org.apache.pulsar.functions.api.SerDe outputSerDe)
Setup the output with a provided outputSerDe.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, getSourceprotected final org.apache.pulsar.client.api.PulsarClient client
protected final org.apache.pulsar.functions.proto.Function.FunctionDetails functionDetails
protected Source source
protected void initializeOutputProducer(String outputTopic) throws Exception
Exceptionpublic void sendOutputMessage(Record srcRecord, org.apache.pulsar.client.api.MessageBuilder outputMsgBuilder)
MessageProcessorIf the outputMsgBuilder is null, the implementation doesn't have to send any messages to the output. The implementation can decide to acknowledge the input message based on its process guarantees.
srcRecord - record from sourceoutputMsgBuilder - output message builder. it can be null.public void close()
close in interface AutoCloseableclose in interface MessageProcessorpublic void setupInput(Class<?> inputType) throws Exception
MessageProcessorsetupInput in interface MessageProcessorinputType - the input type of the functionExceptionpublic Record recieveMessage() throws Exception
MessageProcessorrecieveMessage in interface MessageProcessorExceptionpublic void postReceiveMessage(Record record)
The processor implementation can make a decision to process the message based on its processing guarantees. for example, an at-most-once processor can ack the message immediately.
postReceiveMessage in interface MessageProcessorrecord - input message.public void setupOutput(org.apache.pulsar.functions.api.SerDe outputSerDe)
throws Exception
MessageProcessorsetupOutput in interface MessageProcessoroutputSerDe - output serde.ExceptionCopyright © 2017–2018 Apache Software Foundation. All rights reserved.