Skip to content

Commit

Permalink
Redirect Get message by id request when broker not serve for the topic (
Browse files Browse the repository at this point in the history
#7786)

Fixes #7604

Master Issue: #7604

### Motivation

We should redirect Get message by id request when a broker doesn't serve for the topic

### Modifications

* Redirect Get message by id request when a broker doesn't serve for the topic
* ~~Test log config use log4j2.xml not logback.xml
     config by parent pom: -Dlog4j.configurationFile=log4j2.xml~~

### Verifying this change

This change is a trivial change without any test coverage.
  • Loading branch information
rudy2steiner committed Aug 17, 2020
1 parent 58704f9 commit 6580915
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1959,11 +1959,11 @@ protected void internalResetCursorOnPosition(AsyncResponse asyncResponse, String

protected void internalGetMessageById(AsyncResponse asyncResponse, long ledgerId, long entryId,
boolean authoritative) {
verifyReadOperation(authoritative);

PersistentTopic topic = (PersistentTopic) getTopicReference(topicName);
ManagedLedgerImpl ledger = (ManagedLedgerImpl) topic.getManagedLedger();
try {
// will redirect if the topic not owned by current broker
validateReadOperationOnTopic(authoritative);
PersistentTopic topic = (PersistentTopic) getTopicReference(topicName);
ManagedLedgerImpl ledger = (ManagedLedgerImpl) topic.getManagedLedger();
ledger.asyncReadEntry(new PositionImpl(ledgerId, entryId), new AsyncCallbacks.ReadEntryCallback() {
@Override
public void readEntryFailed(ManagedLedgerException exception, Object ctx) {
Expand Down

0 comments on commit 6580915

Please sign in to comment.