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

Add Respond() #472

Merged
merged 1 commit into from
May 25, 2019
Merged

Add Respond() #472

merged 1 commit into from
May 25, 2019

Conversation

derekcollison
Copy link
Member

This will allow a user to respond to a subscription callback that has not closed over a connection by referencing the request message.

func cb(m *nats.Msg) {
  m.Respond([]byte("I am here")
}

This will allow a user to respond to a subscription callback that has not closed over a connection by referencing the request message.

func cb(m *nats.Msg) {
  m.Respond([]byte("I am here")
}
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM, just simple comment about testing the no-reply condition

t.Fatal("Failed to subscribe: ", err)
}

// Fake the bound notion by assigning Sub directly to test no reply.
Copy link
Member

Choose a reason for hiding this comment

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

I would have simply created a sync sub on another subject, publish a message (not request) to that subject, get the message, then call respond. No need to fake it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Its public so easy to do, but if you feel strongly I could make legit here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants