Get topic messages
Subscribe to a topic ID's messages from a mirror node. You will receive all messages for the specified topic or within the defined start and end time.
Query Fees
The SDK uses the Hedera Consensus Service gRPC APIs provided by the mirror node to perform this function for free.
Methods
Method
Type
Description
Requirement
setTopicId(<topicId>)
TopicId
The topic ID to subscribe to
Required
setStartTime(<startTime>)
Instant
The time to start subscribing to a topic's messages
Optional
setEndTime(<endTime>)
Instant
The time to stop subscribing to a topic's messages
Optional
setLimit(<limit>)
long
The number of messages to return
Optional
subscribe(<client, onNext)
SubscriptionHandle
Client, Consumer<TopicMessage>
Required
Last updated
Was this helpful?