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

Running REQ/REP as an RPC #118

Open
jborden13 opened this issue Mar 10, 2016 · 0 comments
Open

Running REQ/REP as an RPC #118

jborden13 opened this issue Mar 10, 2016 · 0 comments

Comments

@jborden13
Copy link

Hi, I'm attempting to run as an RPC using the Request/Reply socket types. Everything is working great, until it is time to respond back with a message. I've tried responding directly back to the replyTo, but I'm getting:

Error: Channel closed by server: 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - queue name 'amq.gen-sMgjS-5c4qvKKR2ArMhKTA' contains reserved prefix 'amq.*'

Which makes sense that it's a reserved queue name. But if I can't write to it, how do I reply?

Request:

context.on("ready", function () {
    var request = context.socket("REQ", {expiration: TIMEOUT}); 
     request.setEncoding('utf8');
     request.on("data", function (message) {
      process.nextTick(function () {
        request.close();
        res.send(message, {});
      });
    });
     request.connect("RPCQueueName", function () {
      var message = JSON.stringify(req.body);
      console.log(request);
      request.write(message, "utf8");
    });
  });

Reply:

reply.connect(json.ReplyTo, function () {
                            reply.setEncoding('utf8');
                            reply.write(JSON.stringify({ Response: 'response' }), "utf8");
                        });

I've tried messing with the replyTo and correlationId to no avail. Do you know of any ways to reply directly to an AMPQ queue - or another method?

In your documentation you wrote:

If you are replying via AMQP or STOMP, be sure to follow the convention of sending the response to the queue given in the 'replyTo' property of the request message, and copying the 'correlationId' property from the request in the reply. If you are requesting via AMQP or STOMP, at least supply a replyTo, and consider supplying a correlationId.

Can you provide an example of how to correctly supply the replyTo and correlationId for the request and how to best follow the convention of sending the response to the queue? I've been scouring the docs for days with no luck. Thanks!

@jborden13 jborden13 changed the title H Running REQ/REP as an RPC Mar 10, 2016
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

1 participant