Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

GetMessageAsync for node #2415

Closed
ArturPrzybysz opened this issue Feb 8, 2018 · 18 comments
Closed

GetMessageAsync for node #2415

ArturPrzybysz opened this issue Feb 8, 2018 · 18 comments
Labels
customer-reported This issue was reported by a customer. Service Attention Service Bus

Comments

@ArturPrzybysz
Copy link

I am looking for a way to detect new messages in azure queue. I have found in .NET sdk getMessageAsync, which fits perfectly but sadly i cannot find its equivalent in nodes sdk.

Am I missing something and its available, or its simply not implemented?

@amarzavery
Copy link
Contributor

We are working on a newer service bus library. The current library azure-sb is not being actively maintained.

@tony-gutierrez
Copy link

Is there a url for the newer library?

@amarzavery
Copy link
Contributor

It is not yet ready. The new library that is being developed is based on amqp protocol. As soon as we have something ready we will share the early bits with you.

@tony-gutierrez
Copy link

@ArturPrzybysz In the meantime, you can follow the example I built in this pull request: noodlefrenzy/node-amqp10#356

@amarzavery The current node SDK should come with a big blatant warning that it introduces delays of about a minute into retrieving Service Bus messages.

@amarzavery
Copy link
Contributor

@tony-gutierrez The current sbus sdk azure-sb is an http based library. It is much slower than an amqp based library. That is the prime reason we are working on building a better amqp based library.
I saw that you have been looking at node-amqp10.

Did you ever get a chance to look at rhea?

@tony-gutierrez
Copy link

Haven't looked at it. I gave it a quick try but ran into

[connection-1] error on read: ProtocolError: Invalid AMQP protocol id 2 expecting: 0  (buffer:0x41,0x4d,0x51,0x50,0x02,0x01,0x00,0x00)
[connection-1] error: Error: read ECONNRESET

Also amqp10 is by one of your colleagues!

@amarzavery
Copy link
Contributor

Oh! amqp10 is written by one of my colleagues. However there is some history to it. It was written by him when he was actively working on that project, while he was not an MS employee. He and his other colleague have moved on to other projects and the library isn't actively being maintained yet. Some teams in azure took a dependency on amqp10 library and found multiple issues with the way the library manages the states of link, session, connection.

As a part of developing an amqp based node.js library for servicebus we are evaluating all the options along the vertical stack w.r.t it's stability, performance and active maintenance.

I got rhea working for a simple send receive with sbus. Here is the script.

node test.js Endpoint=amqps://<foo>.servicebus.windows.net;SharedAccessKeyName=<KeyName>;SharedAccessKey=<keyValue> <queueName>

@tony-gutierrez
Copy link

I gave a try to send the sas token to $cbs but I cant even get it to connect to the service bus in anonymous mode.

@tony-gutierrez
Copy link

@amarzavery Do you by any chance know anything about posting to notification hub with amqp? If I can do that I can get rid of the last vestige of the azure api.

We have had a lot of issues with the linux app service network being super slow to reach the http post endpoints for both NH and SB. Times out about 60% of the time sometimes. MS is on that issue, but I'd love to be full AMQP.

@amarzavery
Copy link
Contributor

I have not played with notification hubs. I am playing with eventhubs right now.

For $cbs, i was able to connect. However, I am getting an error in the end. I am messing up somewhere. I am trying to send put-token and get the initial response.

For SASL anonymous, only provide the username while connecting, do not provide the password. Then rhea will automatically apply sasl anonymous. you can enable set DEBUG=rhea* and see the debug logs. You will see that while negotiating SASL mechanism it is using the "ANONYMOUS" performative.
I see an error like this:

rhea:events Link got event: message +25ms
rx:  {"correlation_id":"bda886b0-28b8-4de8-ba1a-34b099783030","application_properties":{"status-code":500,"status-description":"The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101","error-condition":"amqp:internal-error"}}

Hopefully will be able to figure out something by tomorrow for $cbs.

@tony-gutierrez
Copy link

For amqp10 that token had to be sent as a special type AMQPval. Not sure how you will tell rhea to force it to that type. Add a listener on $cbs and set the replyTo property on your token message to point to $cbs to aid in debugging. Make sure you have you application_properties on that token message too.

@amarzavery
Copy link
Contributor

amarzavery commented Feb 18, 2018

I got the basic put-token request part of cbs auth working for eventhubs. I am sure it would be the same for service bus as well. Here is the link to the sample.

node cbs.js Endpoint=sb://<foo>.servicebus.windows.net;SharedAccessKeyName=<KeyName>;SharedAccessKey=<keyValue>;EntityPath=<eventhubName>

@tony-gutierrez
Copy link

@amarzavery Have you gotten any farther in your RHEA implementations? I have to make some changes to SB AQMP code and thought now might be a good time to look at it again. Let me know if you have any newer code samples.

@jordan-zilch
Copy link

@amarzavery Any updates on that AMQP based service bus library? Also, could I have any guidance on using amqp10 or that rhea script for receiving messages async from SB topics?

@ghost ghost added this to the Sprint-127 milestone Nov 5, 2018
@ghost ghost added the customer-reported This issue was reported by a customer. label Dec 4, 2018
@ghost ghost removed this from the Sprint-127 milestone Dec 4, 2018
@amarzavery
Copy link
Contributor

@ArturPrzybysz , @tony-gutierrez -
Please try the new sdk npm i @azure/service-bus.

Sample for the above mentioned usecase can be found here https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/servicebus/service-bus/samples/typescript/gettingStarted/receiveMessagesStreaming.ts#L33

Please file service bus related issues in the new repo https://github.com/Azure/azure-sdk-for-js

@tony-gutierrez
Copy link

@amarzavery Does this also cover notification hub?

@tony-gutierrez
Copy link

The sdk reference doesnt seem to be updated? https://docs.microsoft.com/en-us/javascript/api/azure-sb

@amarzavery
Copy link
Contributor

The API docs still need to be updated as we are in the process of creating the API docs for the new sdk. Nope it does not cover notification hubs yet. We have new sdks for EventHubs and ServiceBus.
/cc @ramya-rao-a

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported This issue was reported by a customer. Service Attention Service Bus
Projects
None yet
Development

No branches or pull requests

5 participants