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

Not possible to access the message headers via a 'context' on a response #64

Open
ramonsmits opened this issue May 17, 2017 · 1 comment

Comments

@ramonsmits
Copy link
Member

When using callbacks it is not possible to access header data via the context on a response. Meaning that if an endpoint does something like the following the receiver of the response is unable to process this:

Client

var response = await endpoint.Request<MyResponse>(new MyRequest())
// No access to header data

Server

Task Handle(MyRequest request, IMessageHandlerContext context)
{
    var replyOptions = new ReplyOptions();
    var replyOptions.SetHeader("MyHeaderKey", "All your base are belong to us!");
    return context.Reply(new MyResponse(), replyOptions);
}

For this to work we would require an overload like any of the following or even a different signature:

var responseEnvelope = await bus.RequestWithHeaders<MyResponse>(new MyRequest(), options)
var headerValue = responseEnvelope.Headers["MyHeaderKey"]
var message = responseEnvelope.Message;

-or-

await bus.Request<MyResponse>(new MyRequest(), options,  Func<MyResponse,CallbackResponseContext>)
@bording
Copy link
Member

bording commented May 17, 2017

@ramonsmits What use case do you see for doing this that couldn't just be handled by adding the value to the message directly?

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

No branches or pull requests

2 participants