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 AMQP header properties available #1

Open
wants to merge 1 commit into
base: feature/do-ack
Choose a base branch
from

Conversation

DaGenix
Copy link

@DaGenix DaGenix commented Feb 27, 2017

Unfortunately, there is no way to pass these headers directly to the
handler function since the handler function is called by the Thrift
generated code and that code has no way to add in extra parameters not
declared in the Thrift file. However, we do know that node is single
thread. So, what we can do is make the properties available as a
property on the AMQPServer object. From there, we can copy them into the
handler's body. Since Node is single threaded, we can be sure that
between the time that this variable is set on the AMQPServer object and
when the handler function initially runs, no other messages will be
processed. As soon as the handler exits, of course, another message may
be received - but sinced we've saved them to a variable in our handler
function, we don't have to worry about that.

Unfortunately, there is no way to pass these headers directly to the
handler function since the handler function is called by the Thrift
generated code and that code has no way to add in extra parameters not
declared in the Thrift file. However, we do know that node is single
thread. So, what we can do is make the properties available as a
property on the AMQPServer object. From there, we can copy them into the
handler's body. Since Node is single threaded, we can be sure that
between the time that this variable is set on the AMQPServer object and
when the handler function initially runs, no other messages will be
processed. As soon as the handler exits, of course, another message may
be received - but sinced we've saved them to a variable in our handler
function, we don't have to worry about that.
@dorilla dorilla changed the base branch from master to feature/do-ack February 28, 2017 00:10
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.

1 participant