rabbot icon indicating copy to clipboard operation
rabbot copied to clipboard

request with stream - Request failed no connection

Open djeeg opened this issue 8 years ago • 1 comments

Hi, trying out the new release, previously I had something like this

rabbot.request('message', {})
	.progress()
	.then()

Now upgrading to this as per https://github.com/arobson/rabbot/blob/master/docs/publishing.md#expecting-a-stream

rabbot.request('message', {}, reply => {
		reply.ack();
	})
	.then( final => {
		final.ack();
	});

Gives me this error

Error: Request failed - no connection function (reply) {
reply.ack();
} has been configured
at Broker.request (/serviceroot/node_modules/rabbot/src/index.js:450:27)

Now I am not sure if I have the intermediate ack right The docs have part.ack(), though I dont see a part, is that the same as the reply object?

Though it turns out I am not really using multi-response messages, so I have just commented out the third arg and its works fine with just the single final ack in the then.

djeeg avatar Mar 29 '18 19:03 djeeg

Your problem lies in https://github.com/arobson/rabbot/blob/v2/src/index.js#L317. In v2 the request is rabbot.request( exchangeName, options, notify, [connectionName] ). In v1 the absence of notify parameter was getting handled (https://github.com/arobson/rabbot/blob/v1/src/index.js#L318). Either @arobson can fix that, by adding a parameter handler or you need to adjust your code.

JimiC avatar Jul 27 '18 09:07 JimiC