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

Async response overrides the original 202 #3

Open
hnnesv opened this issue Jan 15, 2015 · 4 comments
Open

Async response overrides the original 202 #3

hnnesv opened this issue Jan 15, 2015 · 4 comments
Labels

Comments

@hnnesv
Copy link
Contributor

hnnesv commented Jan 15, 2015

See discussion in PR #2

During async processing, the mediator will respond to core with a status of 202 (Accepted) and then later update the transaction with the final response via the API. However this update overrides the original 202 route with the final response.

Should we think of a way to keep the 202 response, and somehow add the final response, perhaps to another route?

cc @rcrichton @armageddon @bausmeier

@rcrichton
Copy link
Member

Do we capture the primary route details with the rest of the routes in the transactions object. I think we do. If so maybe what we could do is leave the transaction.response as the 202 but update the route response (transaction.routes[0].response) with the detail that we received asynchronously. That way both responses are captured but it clearly shows that the transaction was handled asynchronously and that the client received a 202.

@hnnesv
Copy link
Contributor Author

hnnesv commented Jan 15, 2015

Actually I'm not certain we do: https://github.com/jembi/openhim-core-js/blob/master/test/unit/messageStoreTest.coffee#L154-L172. It's looks like routes is only being added to on non-primary. But so maybe we should add handling to add the primary to the routes object as well?

Hmmm, also what if the async mediator is being called from a non-primary route?

Maybe we could have the async mediator add a route to the transaction when it finishes...

@rcrichton
Copy link
Member

Yeah I think it makes sense to add the primary response to routes object in all cases. If this happens do we need to still add a route to the transaction when it finishes? Or am I missing something?

@hnnesv
Copy link
Contributor Author

hnnesv commented Jan 16, 2015

Yeah, I was thinking about the case where an async mediator is called from a non-primary route.

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

No branches or pull requests

2 participants