Package org.apache.pulsar.client.impl
Class ProducerBase<T>
java.lang.Object
org.apache.pulsar.client.impl.ProducerBase<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Producer<T>
- Direct Known Subclasses:
PartitionedProducerImpl
,ProducerImpl
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final PulsarClientImpl
protected final ProducerConfigurationData
protected final ProducerInterceptors
protected ProducerBase.MultiSchemaMode
protected final CompletableFuture<Producer<T>>
protected URI
protected final ConcurrentOpenHashMap<SchemaHash,
byte[]> protected final String
-
Constructor Summary
ModifierConstructorDescriptionprotected
ProducerBase
(PulsarClientImpl client, String topic, ProducerConfigurationData conf, CompletableFuture<Producer<T>> producerCreatedFuture, Schema<T> schema, ProducerInterceptors interceptors) -
Method Summary
Modifier and TypeMethodDescriptionprotected Message<?>
beforeSend
(Message<?> message) protected boolean
protected boolean
protected boolean
void
close()
abstract CompletableFuture<Void>
void
flush()
protected org.apache.pulsar.client.impl.HandlerState.State
getAndUpdateState
(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater) protected org.apache.pulsar.client.impl.HandlerState.State
getState()
getTopic()
<V> TypedMessageBuilder<V>
newMessage
(Schema<V> schema) newMessage
(Transaction txn) protected void
onPartitionsChange
(String topicName, int partitions) protected void
onSendAcknowledgement
(Message<?> message, MessageId msgId, Throwable exception) protected void
setRedirectedClusterURI
(String serviceUrl, String serviceUrlTls) protected void
setState
(org.apache.pulsar.client.impl.HandlerState.State s) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.pulsar.client.api.Producer
flushAsync, getLastDisconnectedTimestamp, getLastSequenceId, getNumOfPartitions, getProducerName, getStats, isConnected
-
Field Details
-
producerCreatedFuture
-
conf
-
schema
-
interceptors
-
schemaCache
-
multiSchemaMode
-
client
-
topic
-
redirectedClusterURI
-
-
Constructor Details
-
ProducerBase
protected ProducerBase(PulsarClientImpl client, String topic, ProducerConfigurationData conf, CompletableFuture<Producer<T>> producerCreatedFuture, Schema<T> schema, ProducerInterceptors interceptors)
-
-
Method Details
-
send
- Specified by:
send
in interfaceProducer<T>
- Throws:
PulsarClientException
-
sendAsync
-
sendAsync
-
newMessage
- Specified by:
newMessage
in interfaceProducer<T>
-
newMessage
- Specified by:
newMessage
in interfaceProducer<T>
-
newMessage
- Specified by:
newMessage
in interfaceProducer<T>
-
send
- Throws:
PulsarClientException
-
flush
- Specified by:
flush
in interfaceProducer<T>
- Throws:
PulsarClientException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceProducer<T>
- Throws:
PulsarClientException
-
closeAsync
- Specified by:
closeAsync
in interfaceProducer<T>
-
getTopic
-
getConfiguration
-
producerCreatedFuture
-
beforeSend
-
onSendAcknowledgement
-
onPartitionsChange
-
toString
-
setRedirectedClusterURI
protected void setRedirectedClusterURI(String serviceUrl, String serviceUrlTls) throws URISyntaxException - Throws:
URISyntaxException
-
changeToReadyState
protected boolean changeToReadyState() -
changeToRegisteringSchemaState
protected boolean changeToRegisteringSchemaState() -
getState
protected org.apache.pulsar.client.impl.HandlerState.State getState() -
changeToConnecting
protected boolean changeToConnecting() -
setState
protected void setState(org.apache.pulsar.client.impl.HandlerState.State s) -
getAndUpdateState
protected org.apache.pulsar.client.impl.HandlerState.State getAndUpdateState(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater) -
getClient
-