-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PIP-22: Dead Letter Topic #2400
Closed
Closed
Changes from 44 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
be74b4e
Add `redeliveryCount` and `deadLetterTopic` to CommandSubscribe in Pu…
3cc25d1
Add `maxRedeliveryCount` and `deadLetterTopic` to java client
44cf08e
Add RedeliveryTracker
d4ff25c
Implement of Dead Letter Topic
2f4957a
Fix import
8867373
Update maxRedeliveryCount and deadLetterTopic in PersistentDispatcher…
195bf0b
Fix bug:
5ae3c46
Add `redeliveryCount` and `deadLetterTopic` to CommandSubscribe in Pu…
1529fcb
Add `maxRedeliveryCount` and `deadLetterTopic` to java client
ec6da32
Add RedeliveryTracker
8e6c96a
Implement of Dead Letter Topic
6bb9281
Fix import
ccf8abb
Update maxRedeliveryCount and deadLetterTopic in PersistentDispatcher…
eeae4ea
Fix bug:
22f5e58
Fix bug of generate default dead letter topic. Add dead letter tutorial.
49b7cac
Merge remote-tracking branch 'origin/DLQ' into DLQ
74e1e8d
Fix bug of deserialize entry
5716023
Fix send dead letter topic with exception message can't re-use
05aaad2
Fix bug in tutorial of SubscriptionWithDeadLetter
9fe5541
Add read entry by position in ManagedCursor
c2503c4
Add `redeliveryCount` and `deadLetterTopic` to CommandSubscribe in Pu…
6bd204c
Add `maxRedeliveryCount` and `deadLetterTopic` to java client
f4a77f8
Add RedeliveryTracker
30d2bf1
Implement of Dead Letter Topic
f5ea1c4
Fix import
1107481
Update maxRedeliveryCount and deadLetterTopic in PersistentDispatcher…
9e895f8
Fix bug:
4c41659
Fix bug of generate default dead letter topic. Add dead letter tutorial.
3ab4834
Fix bug of deserialize entry
b5bee1f
Fix send dead letter topic with exception message can't re-use
a419677
Fix bug in tutorial of SubscriptionWithDeadLetter
8543ed5
Add read entry by position in ManagedCursor
256a9b9
Merge remote-tracking branch 'origin/DLQ' into DLQ
2283c9d
Fix bug in consumer subscribe with dead letter
c6a505b
Add test for subscribe info changed(maxRedeliverCount, deadLetterTopic)
7d578a0
enable module pulsar-sql
e141968
Optimization send messages to dead letter topic.
c714af0
Support set maxUnackedMessagePerConsumer by client.
9cd60c4
add UT for dead letter topic.
1882707
Fix UT with error didn't finish within the time-out 120000
d1fe915
Fix bug of getRedeliveryCount in NonPersistentRedeliveryTracker.
dc31b2f
Fix block client when any messages should send to dead letter topic.
b1b1378
Add comments to Quorum.
4b2c3a9
Add some assert and logs.
2f1028e
Change messagesToDeadLetter store ledgerId and entryId as primitive v…
2c46fc3
Delete unused import.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/RedeliveryTracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.broker.service; | ||
|
||
import org.apache.bookkeeper.mledger.Position; | ||
|
||
import java.util.List; | ||
|
||
public interface RedeliveryTracker { | ||
|
||
int incrementAndGetRedeliveryCount(Position position); | ||
|
||
int getRedeliveryCount(Position position); | ||
|
||
void remove(Position position); | ||
|
||
void removeBatch(List<Position> positions); | ||
|
||
void clear(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...n/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentRedeliveryTracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.broker.service.nonpersistent; | ||
|
||
import org.apache.bookkeeper.mledger.Position; | ||
import org.apache.pulsar.broker.service.RedeliveryTracker; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
public class NonPersistentRedeliveryTracker implements RedeliveryTracker { | ||
|
||
private ConcurrentHashMap<Position, AtomicInteger> trackerCache = new ConcurrentHashMap<>(16); | ||
|
||
@Override | ||
public int incrementAndGetRedeliveryCount(Position position) { | ||
trackerCache.putIfAbsent(position, new AtomicInteger(0)); | ||
return trackerCache.get(position).incrementAndGet(); | ||
} | ||
|
||
@Override | ||
public int getRedeliveryCount(Position position) { | ||
trackerCache.putIfAbsent(position, new AtomicInteger(0)); | ||
return trackerCache.get(position).get(); | ||
} | ||
|
||
@Override | ||
public void remove(Position position) { | ||
trackerCache.remove(position); | ||
} | ||
|
||
@Override | ||
public void removeBatch(List<Position> positions) { | ||
if (positions != null) { | ||
positions.forEach(this::remove); | ||
} | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
trackerCache.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can already be done through
replayEntries()
andasyncReplayEntries()
methodsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When i use asyncReplayEntries(), i should change ConcurrentLongPairSet to Set then call asyncReplayEntries() and in asyncReplayEntries() implement call ledger.asyncReadEntry() foreach. So i think i need a readEntry() method to read entry that no need to change ConcurrentLongPairSet to Set.