Module com.hedera.hashgraph.sdk
Package com.hedera.hashgraph.sdk
Class TopicMessageSubmitTransaction
java.lang.Object
com.hedera.hashgraph.sdk.Executable<TopicMessageSubmitTransaction,Transaction,TransactionResponse,TransactionResponse>
com.hedera.hashgraph.sdk.Transaction<TopicMessageSubmitTransaction>
com.hedera.hashgraph.sdk.ChunkedTransaction<TopicMessageSubmitTransaction>
com.hedera.hashgraph.sdk.TopicMessageSubmitTransaction
public final class TopicMessageSubmitTransaction
extends ChunkedTransaction<TopicMessageSubmitTransaction>
Submit a message for consensus.
Valid and authorized messages on valid topics will be ordered by the consensus service, gossipped to the mirror net, and published (in order) to all subscribers (from the mirror net) on this topic.
The submitKey (if any) must sign this transaction.
On success, the resulting TransactionReceipt contains the topic's updated topicSequenceNumber and topicRunningHash.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Transaction
Transaction.SignableNodeTransactionBodyBytesNested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Executable
Executable.GrpcRequest -
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.ChunkedTransaction
dataFields inherited from class com.hedera.hashgraph.sdk.Transaction
customFeeLimits, DEFAULT_AUTO_RENEW_PERIOD, defaultMaxTransactionFee, DUMMY_ACCOUNT_ID, DUMMY_TRANSACTION_ID, frozenBodyBuilder, innerSignedTransactions, outerTransactions, publicKeys, regenerateTransactionId, signers, sigPairLists, sourceTransactionBody, transactionIdsFields inherited from class com.hedera.hashgraph.sdk.Executable
attemptedAllNodes, blockingUnaryCall, grpcDeadline, logger, maxAttempts, maxBackoff, minBackoff, nodeAccountIds, nodes, random, RST_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.TopicMessageSubmitTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, Transaction>> txs) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddCustomFeeLimit(CustomFeeLimit customFeeLimit) Adds a custom fee limit(package private) ConsensusSubmitMessageTransactionBody.Builderbuild()Build the transaction body.Clears all custom fee limits.Extract the custom fee limits of the transactioncom.google.protobuf.ByteStringExtract the message.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Extract the topic id.(package private) voidInitialize from the transaction body.(package private) voidonFreeze(TransactionBody.Builder bodyBuilder) Called inTransaction.freezeWith(Client)just before the transaction body is built.(package private) voidonFreezeChunk(TransactionBody.Builder body, TransactionID initialTransactionId, int startIndex, int endIndex, int chunk, int total) A common base for file and topic message transactions.(package private) voidonScheduled(SchedulableTransactionBody.Builder scheduled) Called inTransaction.schedule()when converting transaction into a scheduled version.setCustomFeeLimits(List<CustomFeeLimit> customFeeLimits) The maximum custom fee that the user is willing to pay for the message.setMessage(byte[] message) Assign the message from a byte array.setMessage(com.google.protobuf.ByteString message) Assign the message from a byte string.setMessage(String message) Assign the message from a string.setTopicId(TopicId topicId) Assign the topic id.(package private) voidvalidateChecksums(Client client) Methods inherited from class com.hedera.hashgraph.sdk.ChunkedTransaction
addSignature, bodySizeAllChunks, execute, executeAll, executeAll, executeAllAsync, executeAllAsync, executeAllAsync, executeAllAsync, executeAllAsync, executeAllAsync, executeAsync, getAllSignatures, getAllTransactionHashesPerNode, getChunkSize, getData, getMaxChunks, getRequiredChunks, getSignatures, getTransactionHash, getTransactionHashPerNode, schedule, setChunkSize, setData, setData, setData, setMaxChunks, shouldGetReceipt, wipeTransactionListsMethods inherited from class com.hedera.hashgraph.sdk.Transaction
addSignature, batchify, buildAllTransactions, buildTransaction, doSchedule, estimateFee, freeze, freezeWith, fromBytes, fromScheduledTransaction, generateTransactionIds, getBatchKey, getDefaultMaxTransactionFee, getExecutionState, getHighVolume, getMaxTransactionFee, getRegenerateTransactionId, getSignableNodeBodyBytesList, getSignaturesAtOffset, getTransactionBodySize, getTransactionId, getTransactionIdInternal, getTransactionMemo, getTransactionSize, getTransactionValidDuration, hash, isBatchedAndNotBatchTransaction, isFrozen, keyAlreadySigned, makeRequest, mapResponse, mapResponseStatus, onExecute, onExecuteAsync, regenerateTransactionId, requireNotFrozen, requireOneNodeAccountId, setBatchKey, setHighVolume, setMaxTransactionFee, setNodeAccountIds, setRegenerateTransactionId, setTransactionId, setTransactionMemo, setTransactionValidDuration, sign, signTransaction, signWith, signWithOperator, spawnBodyBuilder, toBytes, toStringMethods inherited from class com.hedera.hashgraph.sdk.Executable
advanceRequest, checkNodeAccountIds, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getGrpcRequest, getMaxAttempts, getMaxBackoff, getMaxRetry, getMinBackoff, getNodeAccountIds, getNodeForExecute, grpcDeadline, logTransaction, mergeFromClient, setGrpcDeadline, setLogger, setMaxAttempts, setMaxBackoff, setMaxRetry, setMinBackoff, setNodesFromNodeAccountIds, setRequestListener, setResponseListener, shouldRetryExceptionally
-
Constructor Details
-
TopicMessageSubmitTransaction
public TopicMessageSubmitTransaction()Constructor. -
TopicMessageSubmitTransaction
TopicMessageSubmitTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, throws com.google.protobuf.InvalidProtocolBufferExceptionTransaction>> txs) Constructor.- Parameters:
txs- Compound list of transaction id's list of (AccountId, Transaction) records- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
TopicMessageSubmitTransaction
TopicMessageSubmitTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getTopicId
Extract the topic id.- Returns:
- the topic id
-
setTopicId
Assign the topic id.- Parameters:
topicId- the topic id- Returns:
this
-
getMessage
public com.google.protobuf.ByteString getMessage()Extract the message.- Returns:
- the message
-
setMessage
Assign the message from a byte string.- Parameters:
message- the byte string- Returns:
- the message
-
setMessage
Assign the message from a byte array.- Parameters:
message- the byte array- Returns:
- the message
-
setMessage
Assign the message from a string.- Parameters:
message- the string- Returns:
- the message
-
getCustomFeeLimits
Extract the custom fee limits of the transaction- Returns:
- the custom fee limits of the transaction
-
setCustomFeeLimits
The maximum custom fee that the user is willing to pay for the message. If left empty, the user is willing to pay any custom fee. If used with a transaction type that does not support custom fee limits, the transaction will fail. -
addCustomFeeLimit
Adds a custom fee limit- Parameters:
customFeeLimit-- Returns:
this
-
clearCustomFeeLimits
Clears all custom fee limits.- Returns:
this
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
build
Build the transaction body. -
validateChecksums
- Specified by:
validateChecksumsin classTransaction<TopicMessageSubmitTransaction>- Throws:
BadEntityIdException
-
getMethodDescriptor
io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()Description copied from class:ExecutableCalled to direct the invocation of the query to the appropriate gRPC service.- Specified by:
getMethodDescriptorin classExecutable<TopicMessageSubmitTransaction,Transaction, TransactionResponse, TransactionResponse>
-
onFreeze
Description copied from class:TransactionCalled inTransaction.freezeWith(Client)just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.- Specified by:
onFreezein classTransaction<TopicMessageSubmitTransaction>
-
onFreezeChunk
void onFreezeChunk(TransactionBody.Builder body, @Nullable TransactionID initialTransactionId, int startIndex, int endIndex, int chunk, int total) Description copied from class:ChunkedTransactionA common base for file and topic message transactions.- Specified by:
onFreezeChunkin classChunkedTransaction<TopicMessageSubmitTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<TopicMessageSubmitTransaction>
-