类 ProducerImpl<T>
java.lang.Object
org.apache.pulsar.client.impl.ProducerBase<T>
org.apache.pulsar.client.impl.ProducerImpl<T>
- 所有已实现的接口:
io.netty.util.TimerTask,Closeable,AutoCloseable,Producer<T>
-
嵌套类概要
嵌套类修饰符和类型类说明protected static final classprotected static classQueue implementation that is used as the pending messages queue.从类继承的嵌套类/接口 org.apache.pulsar.client.impl.ProducerBase
ProducerBase.MultiSchemaMode -
字段概要
字段修饰符和类型字段说明protected final PulsarClientImplprotected longprotected final longprotected URIprotected final String从类继承的字段 org.apache.pulsar.client.impl.ProducerBase
conf, interceptors, multiSchemaMode, producerCreatedFuture, schema, schemaCache -
构造器概要
构造器构造器说明ProducerImpl(PulsarClientImpl client, String topic, ProducerConfigurationData conf, CompletableFuture<Producer<T>> producerCreatedFuture, int partitionIndex, Schema<T> schema, ProducerInterceptors interceptors, Optional<String> overrideProducerName) -
方法概要
修饰符和类型方法说明intprotected booleanprotected booleanprotected booleanvoidconnectionFailed(PulsarClientException exception) protected ProducerImpl.OpSendMsgQueueprotected io.netty.buffer.ByteBufencryptMessage(MessageMetadata msgMetadata, io.netty.buffer.ByteBuf compressedPayload) protected org.apache.pulsar.client.impl.HandlerState.StategetAndUpdateState(UnaryOperator<org.apache.pulsar.client.impl.HandlerState.State> updater) protected Commands.ChecksumTypeprotected ClientCnxHook method for testing.longlonglongintintprotected org.apache.pulsar.client.impl.HandlerState.StategetState()getStats()booleanbooleanprotected voidprotected voidrecoverChecksumError(ClientCnx cnx, long sequenceId) Checks message checksum to retry if message was corrupted while sending to broker.protected voidrecoverNotAllowedError(long sequenceId, String errorMsg) voidrun(io.netty.util.Timeout timeout) Process sendTimeout events.protected voidsemaphoreRelease(int releaseCountRequest) voidsendAsync(Message<?> message, SendCallback callback) protected ByteBufPairsendMessage(long producerId, long sequenceId, int numMessages, MessageId messageId, MessageMetadata msgMetadata, io.netty.buffer.ByteBuf compressedPayload) protected ByteBufPairsendMessage(long producerId, long lowestSequenceId, long highestSequenceId, int numMessages, MessageMetadata msgMetadata, io.netty.buffer.ByteBuf compressedPayload) protected voidsetRedirectedClusterURI(String serviceUrl, String serviceUrlTls) protected voidsetState(org.apache.pulsar.client.impl.HandlerState.State s) voidterminated(ClientCnx cnx) protected voidprotected booleanComputes checksum again and verifies it against existing checksum.从类继承的方法 org.apache.pulsar.client.impl.ProducerBase
beforeSend, close, flush, getConfiguration, getTopic, newMessage, newMessage, newMessage, onPartitionsChange, onSendAcknowledgement, producerCreatedFuture, send, send, sendAsync, sendAsync, toString
-
字段详细资料
-
producerId
protected final long producerId -
lastSequenceIdPushed
protected volatile long lastSequenceIdPushed -
client
-
topic
-
redirectedClusterURI
-
-
构造器详细资料
-
ProducerImpl
public ProducerImpl(PulsarClientImpl client, String topic, ProducerConfigurationData conf, CompletableFuture<Producer<T>> producerCreatedFuture, int partitionIndex, Schema<T> schema, ProducerInterceptors interceptors, Optional<String> overrideProducerName)
-
-
方法详细资料
-
semaphoreRelease
protected void semaphoreRelease(int releaseCountRequest) -
createPendingMessagesQueue
-
getConnectionHandler
-
getLastSequenceId
public long getLastSequenceId()- 指定者:
getLastSequenceId在接口中Producer<T>
-
sendAsync
-
getNumOfPartitions
public int getNumOfPartitions()- 指定者:
getNumOfPartitions在接口中Producer<T>
-
encryptMessage
protected io.netty.buffer.ByteBuf encryptMessage(MessageMetadata msgMetadata, io.netty.buffer.ByteBuf compressedPayload) throws PulsarClientException -
sendMessage
protected ByteBufPair sendMessage(long producerId, long sequenceId, int numMessages, MessageId messageId, MessageMetadata msgMetadata, io.netty.buffer.ByteBuf compressedPayload) -
sendMessage
protected ByteBufPair sendMessage(long producerId, long lowestSequenceId, long highestSequenceId, int numMessages, MessageMetadata msgMetadata, io.netty.buffer.ByteBuf compressedPayload) -
getChecksumType
-
closeAsync
- 指定者:
closeAsync在接口中Producer<T>- 指定者:
closeAsync在类中ProducerBase<T>
-
isConnected
public boolean isConnected()- 指定者:
isConnected在接口中Producer<T>
-
getCnxIfReady
Hook method for testing. By returning null, it's possible to prevent messages being delivered to the broker.- 返回:
- cnx if OpSend messages should be written to open connection. Caller must verify that the returned cnx is not null before using reference.
-
getLastDisconnectedTimestamp
public long getLastDisconnectedTimestamp()- 指定者:
getLastDisconnectedTimestamp在接口中Producer<T>
-
isWritable
public boolean isWritable() -
terminated
-
recoverChecksumError
Checks message checksum to retry if message was corrupted while sending to broker. Recomputes checksum of the message header-payload again.- if matches with existing checksum: it means message was corrupt while sending to broker. So, resend message
- if doesn't match with existing checksum: it means message is already corrupt and can't retry again. So, fail send-message by failing callback
- 参数:
cnx-sequenceId-
-
recoverNotAllowedError
-
verifyLocalBufferIsNotCorrupted
Computes checksum again and verifies it against existing checksum. If checksum doesn't match it means that message is corrupt.- 参数:
op-- 返回:
- returns true only if message is not modified and computed-checksum is same as previous checksum else return false that means that message is corrupted. Returns true if checksum is not present.
-
connectionOpened
-
connectionFailed
-
brokerChecksumSupportedVersion
public int brokerChecksumSupportedVersion() -
run
Process sendTimeout events.- 指定者:
run在接口中io.netty.util.TimerTask- 抛出:
Exception
-
flushAsync
- 指定者:
flushAsync在接口中Producer<T>
-
triggerFlush
protected void triggerFlush() -
processOpSendMsg
-
getDelayInMillis
public long getDelayInMillis() -
getConnectionId
-
getConnectedSince
-
getPendingQueueSize
public int getPendingQueueSize() -
getStats
-
getProducerName
- 指定者:
getProducerName在接口中Producer<T>
-
getClientCnx
-
setRedirectedClusterURI
protected void setRedirectedClusterURI(String serviceUrl, String serviceUrlTls) 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
-