1

I have a problem when try to send a message to a service bus topic through java azure sdk, I receive 500 Internal Server Error.

I prepared code based on this link: https://azure.microsoft.com/en-us/documentation/articles/service-bus-java-how-to-use-topics-subscriptions/ and my code looks like below:

Configuration config = ServiceBusConfiguration.configureWithSASAuthentication(
    "NAMESPACE",
    "SAS_NAME",
    "SAS_KEY_VALUE",
    ".servicebus.windows.net");      
ServiceBusContract service = ServiceBusService.create(config);
try {
    BrokeredMessage message = new BrokeredMessage("Message content");
    service.sendTopicMessage("TOPIC_NAME", message);
} catch (ServiceException e) {
    e.printStackTrace();
}

I'm able to send a message with the same config values with .NET code.

And here is the exception that I receive: "com.sun.jersey.api.client.UniformInterfaceException: POST https://NAMESPACE.servicebus.windows.net/TOPIC_NAME/messages?api-version=2013-07 returned a response status of 500 Internal Server Error"

I have also a question about api-version. Why a library put so old api-version in the request? I use the latest version of azure sdk from maven repository:

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-servicebus</artifactId>
    <version>0.9.3</version>
</dependency>
Peter Pan
  • 23,476
  • 4
  • 25
  • 43
Rem
  • 47
  • 1
  • 7

2 Answers2

0

I tried to reproduce your issue, but failed to not get any error information.

According to the REST API “Send Message”, the 500 status code means internal error that's not caused by your client source code.

So I think you can try to run the code again.

Could you share more information for helping analyze the issue if you still get the same error or others?

Any concern, please feel free to let me know.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • I have still this problem, I run it a few times and always receive the same error. I don't have direct access to azure, I have only SAS and topic details and need to send a message to that topic. I wonder if the reason can by the api-version that is added to the REST request by azure sdk library? I don't know if it is possible but I will try to put a message to the topic directly by REST API without azure sdk. – Rem Apr 26 '16 at 10:39
0

I finally manage to find the reason of the issue. The real error is "There is no matching subscription found for the message with MessageId ..". This error occurs when in a topic configuration an option "Filter message before publishing" is checked and no matching subscription exists.

The problem is that a call to Azure REST API, which is used by Azure Java SDK, instead of information about no matching subscription found, returns just 500 Internal Server Error.. Only a call from Azure .NET SDK returns an exception with a useful comment.

Rem
  • 47
  • 1
  • 7