未验证 提交 6580915c 编写于 作者: R Rudy Steiner 提交者: GitHub

Redirect Get message by id request when broker not serve for the topic (#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.
上级 58704f9e
......@@ -1959,11 +1959,11 @@ public class PersistentTopicsBase extends AdminResource {
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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册