Skip to content

Conversation

@manishdait
Copy link
Contributor

@manishdait manishdait commented Jul 10, 2025

This PR introduces subscribeTopic() method to the TopicClient interface, which help to subscribe and listen to the messages received by the specific Hedera Topic.

Key Changes:

  • Added getConsensusServiceAddress to NetworkSettings to store the HCS gRPC API inorder to set the mirrorNodeAddress in Client because is because TopicMessageQuery uses the gRPC protocol.

Method Added:

  • subscribeTopic(topicId, consumer)
  • subscribeTopic(topicId, consumer, limit)
  • subscribeTopic(topicId, consumer, startTime, endTime)
  • subscribeTopic(topicId, consumer, limit, startTime, endTime)

Closes: #193

@manishdait manishdait marked this pull request as ready for review July 22, 2025 13:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds subscription functionality to the TopicClient interface, allowing users to subscribe to Hedera topics and listen for incoming messages. The implementation supports various subscription patterns including unlimited subscriptions, limited message counts, and time-bounded subscriptions.

  • Introduces subscribeTopic() method with four overloaded variants for different subscription scenarios
  • Adds getConsensusServiceAddress() to NetworkSettings to provide gRPC endpoints for mirror node connectivity
  • Updates configuration classes to support the new consensus service address field

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
TopicClient.java Added four overloaded subscribeTopic methods to the interface
TopicClientImpl.java Implemented subscription methods with parameter validation
NetworkSettings.java Added getConsensusServiceAddress method to interface
HieroConfig.java Added consensus service address support and updated client creation
HieroContext.java Added getMirrorNodeEndPoint method
TopicMessageRequest.java Added factory methods for different subscription parameter combinations
TopicMessageResult.java Updated to include SubscriptionHandle
ProtocolLayerClientImpl.java Updated to return subscription handle from query execution

Signed-off-by: Manish Dait <[email protected]>
@Ndacyayisenga-droid
Copy link
Member

Ndacyayisenga-droid commented Jul 23, 2025

@manishdait Could you investigate the cause of the build failure? It doesn't appear to be test-related. And tests were fixed so they should pass

@manishdait
Copy link
Contributor Author

@manishdait Could you investigate the cause of the build failure? It doesn't appear to be test-related. And tests were fixed so they should pass

Hi @Ndacyayisenga-droid,

I have added the missing methodS to EnvBasedHieroConfig and NetworkSettingsBasedHieroConfig which is causing the the build failures and have also updated the test for topicSubscribe() method and added consensusServiceAddress for SoloNetworkTestConfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide subscribeTopic() to TopicClient

2 participants