hiero-ledger / hiero-ledger/hiero-enterprise-java

Add topic message lookup by consensus timestamp

Open
#101 2 comments 0 reactions 1 assignee Claimed by @alejandroGM0 View on GitHub
approved
Dominant language
Java
Stars
6
Forks
21
Avg merge
10h 27m
Merged PRs (30d)
37

Description

## Summary
Add public support for looking up a topic message by consensus timestamp.

Today the topic query surface supports:
- topic detail lookup
- topic message listing
- topic message lookup by sequence number

It does not expose a typed Java API for direct lookup by consensus timestamp.

## Scope
This issue is limited to the missing consensus-timestamp lookup path.

Out of scope:
- MicroProfile `TopicClient` CDI wiring, which is already tracked by #63
- A broader event observer or subscription framework, which is separate from direct Mirror Node lookup behavior

## Current gap
In base, `TopicRepository` / `MirrorNodeClient` expose list + sequence-number lookup, but no timestamp-based lookup.

In transport, `MirrorNodeRestClient` only has a dedicated topic single-message method for:
- `GET /api/v1/topics/{topicId}/messages/{sequenceNumber}`

There is no corresponding public method for retrieving a message by consensus timestamp.

## Why this matters
Mirror Node topic APIs support direct retrieval of a message by consensus timestamp. This is useful for explorers, indexing pipelines, and applications that persist timestamps rather than sequence numbers.

## REST/API notes
Official docs currently show topic consensus-timestamp lookup, but there is a docs/path discrepancy:
- Topics overview lists `GET /api/v1/topics/{id}/messages/{consensusTimestamp}`
- API reference documents `GET /api/v1/topics/messages/{timestamp}`

The implementation should verify the actual Mirror Node endpoint behavior and expose a typed timestamp lookup in the public Java API.

## Proposed implementation
- Extend `MirrorNodeClient` with topic message lookup by consensus timestamp
- Extend `TopicRepository` with the same lookup
- Add the corresponding REST client method
- Implement the lookup for Spring and MicroProfile transports
- Add tests for JSON conversion and at least one repository/client path
- Verify timestamp lookup responses map consistently with sequence-number lookup responses

## Acceptance criteria
- Topic message lookup by consensus timestamp is publicly available
- The lookup works through the public repository/client API
- Spring and MicroProfile implementations support the new lookup consistently
- Tests cover timestamp lookup conversion and client/repository behavior
- This issue does not duplicate #63; MicroProfile `TopicClient` CDI wiring remains tracked there

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.