Skip to content
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

Make sure that DeadLetters published by DistributedPubSubMediator contain full context of topic #6209

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Oct 24, 2022

Changes

This is a usability improvement aimed at making sure we contain the full context of what topic we were trying to publish to or which Put-ed actor we were trying to publish to when there are no subscribers available on the local node.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

… contain full context of topic

This is a usability improvement aimed at making sure we contain the full context of what topic we were trying to publish to or which `Put`-ed actor we were trying to publish to when there are no subscribers available on the local node.
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

Described my changes

@@ -500,7 +500,7 @@ private void IgnoreOrSendToDeadLetters(object message)
Context.System.DeadLetters.Tell(new DeadLetter(message, Sender, Context.Self));
}

private void PublishMessage(string path, object message, bool allButSelf = false)
private void PublishMessage(string path, IWrappedMessage publish, bool allButSelf = false)
Copy link
Member Author

Choose a reason for hiding this comment

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

Rather than send just the object Message to these methods, send the full IWrappedMessage payload which we'll pass directly to the IgnoreOrSendToDeadLetters method - as that wrapper message includes all of the useful debugging context a developer might need.

{
var prefix = path + "/";
var lastKey = path + "0"; // '0' is the next char of '/'

var groups = ExtractGroups(prefix, lastKey).GroupBy(kv => kv.Key).ToList();
var wrappedMessage = new SendToOneSubscriber(message);
var wrappedMessage = new SendToOneSubscriber(publish.Message);
Copy link
Member Author

Choose a reason for hiding this comment

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

Forward only the payload to the subscriber still, preserving the same behavior as before.


if (groups.Count == 0)
{
IgnoreOrSendToDeadLetters(message);
IgnoreOrSendToDeadLetters(publish);
Copy link
Member Author

Choose a reason for hiding this comment

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

Send the full, debuggable payload to DeadLetters

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

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

LGTM

@Arkatufus Arkatufus merged commit 9f84438 into akkadotnet:v1.4 Oct 24, 2022
@Aaronontheweb Aaronontheweb deleted the dps-cleanup-deadletters branch October 24, 2022 17:22
Arkatufus pushed a commit to Arkatufus/akka.net that referenced this pull request Oct 24, 2022
… contain full context of topic (akkadotnet#6209)

This is a usability improvement aimed at making sure we contain the full context of what topic we were trying to publish to or which `Put`-ed actor we were trying to publish to when there are no subscribers available on the local node.

(cherry picked from commit 9f84438)
Aaronontheweb added a commit that referenced this pull request Oct 24, 2022
… contain full context of topic (#6209) (#6212)

This is a usability improvement aimed at making sure we contain the full context of what topic we were trying to publish to or which `Put`-ed actor we were trying to publish to when there are no subscribers available on the local node.

(cherry picked from commit 9f84438)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants