Azure / azure-service-bus-java

☁️ Java client library for Azure Service Bus
https://azure.microsoft.com/services/service-bus
MIT License
60 stars 59 forks source link

ServiceBusException while connecting from Android application #402

Open asbapat opened 4 years ago

asbapat commented 4 years ago

I am trying to subscribe to azure service bus from android application using Topic based subscription and SASAuthorizationToken. However I am getting the following exception:

W/System.err: com.microsoft.azure.servicebus.primitives.ServiceBusException: Error{condition=proton:io, description='null', info=null} at com.microsoft.azure.servicebus.primitives.ExceptionUtil.toException(ExceptionUtil.java:74) at com.microsoft.azure.servicebus.primitives.MessagingFactory.onConnectionError(MessagingFactory.java:414) at com.microsoft.azure.servicebus.amqp.ConnectionHandler.onTransportError(ConnectionHandler.java:170) at org.apache.qpid.proton.engine.BaseHandler.handle(BaseHandler.java:191) at org.apache.qpid.proton.engine.impl.EventImpl.dispatch(EventImpl.java:108) at org.apache.qpid.proton.reactor.impl.ReactorImpl.dispatch(ReactorImpl.java:324) at org.apache.qpid.proton.reactor.impl.ReactorImpl.process(ReactorImpl.java:291) at com.microsoft.azure.servicebus.primitives.MessagingFactory$RunReactor.run(MessagingFactory.java:556) at java.lang.Thread.run(Thread.java:764)

Can you please what the exception is and why is it being thrown. Thank you..!!!

vsaroopchand commented 4 years ago

@asbapat just a couple of thoughts to eliminate the SAS token as the issue. Can you try the same token with our C# SDK - we have many samples or use the RootManageSharedAccessKey?

yvgopal commented 4 years ago

What is the connection string you are using? It looks like a failure to establish connection to service bus. Either 1. The connection string is wrong. Or 2. Something with the environment or network or firewall.

vsaroopchand commented 4 years ago

Ultimately, this solution (SB SDK on Android) is not the most elegant way of getting notifications on the device. Have you considered the following options?

Logic Apps > Service Bus Connector > Email via O365 connector Logic Apps > Service Bus Connector > SMS Text Logic Apps > Service Bus Connector > Azure Function w/ Notification Hub bindings for Push Notification

These are all more elegant & use built-in capabilities on the devices.

Andycharalambous commented 4 years ago

I have the same error message but it’s a java app running on azure container instance. I’ve tried using the same connection string with a dot net version of the app also running in ACI and it works just fine. The same java app runs fine locally and also on a normal azure VM.

I can’t figure this out - the logs don’t contain any hints as to what the problem is.

I have connected to the aci container running the java app and tried to telnet to service bus on the AMQP ports with no problems. It’s not a connectivity issue.