Recently in Microsoft Azure, Amazon's AWS has SQS on distributed messaging, and it corresponds to a Service Bus Queueon Microsoft Azure.
The role of Service bus queues is that when the components of a distributed application communicate, the components do not communicate with each other directly, but instead exchange messages through the queues that act as intermediaries. This provides a better way to scale out your application and enhance the resiliency of your architecture, because messages are reliably saved in the queue and do not lose messages because one party crashes.
It is important to note that Azure has another queue, which belongs to the storage storage section, called the Azure Queue, in contrast, because the service bus also includes the subject in addition to the queue topic\ Subscribe to the subscription feature, so that more can arouse my interest, meet the needs of the specific differences between them can be seen in Microsoft Documentation: http://msdn.microsoft.com/library/azure/hh767287, very detailed.
Microsoft offers a variety of open source SDKs for Azure, including. Net,java,nodejs and others.
However, when writing the service Bus Queue sample program Recently, there was a problem with the Java SDK and the Java SDK was unable to complete the authentication and could not manipulate the namespaces (Namespace) and queues on Azure (the queue belongs to the namespace, You need to connect namespaces to complete authentication before you can manipulate queues, topics, etc.).
I. Causes of problems
Microsoft's predecessor changed the way the service bus namespace was certified, previously ACS, and later SAS(Shared access authentication). The official explanation is that SAS provides better performance (SAS only needs to provide connection string information to complete authentication) and other benefits, specifically refer to Microsoft documentation http://blogs.msdn.com/b/cie/archive/2014/08/29/ Service-bus-namespace-creation-on-portal-no-longer-has-acs-connection-string.aspx.
But the problem is that theAzure Java SDK is still using the ACS authentication method , with release on August 4, 2014, when Microsoft Azure Portal has not changed the authentication method. This causes the problem to occur and the Java SDK cannot be used to complete the authentication.
Two. Solution
After looking for information on the web, finding related issues on GitHub, and asking questions on MSDN, there are 4 solutions available, if you still want to program in Java.
1. wait for the Microsoft official next Java SDK release version , the latest version is August 4, 2014, v0.6.0. The following is a reply from Microsoft support:
Specific next release time, I will ask questions on MSDN and private messages above this buddy.
2. Rewrite the Java SDK yourself, because it is open source, essentially a package for the RESTful API, but not clear the workload, I have not tried.
3. Use the restful API directly.
4. Walkround programme, a possible online solution: Using PowerShell to create a service bus namespace, ACS will still be used by default. but I tried many times today and the command failed all of them . Not sure if this method is feasible. Reference Document: http://blogs.msdn.com/b/cie/archive/2014/08/29/ Service-bus-namespace-creation-on-portal-no-longer-has-acs-connection-string.aspx
Three. Reference documentation
1. Azure Java SDK Github
Https://github.com/Azure/azure-sdk-for-java
2. Service Bus namespace creation on Portal no longer have ACS connection string
http://blogs.msdn.com/b/cie/archive/2014/08/29/ Service-bus-namespace-creation-on-portal-no-longer-has-acs-connection-string.aspx
3. Questions and Answers I raised at MSDN
https://social.msdn.microsoft.com/Forums/azure/en-US/dbfdb53c-37f9-4884-8d60-4b77ad418b3a/ Servicebusconfigurationconfigurewithconnectionstring-cant-work-error-the-key?forum=servbus
Four. Code
1 //get connection string from config file2String connectionString =confighandler.getconnectionstring ();3System.out.println ("Connection String:" +connectionString);4 5 //get config6Config =NewConfiguration ();7Servicebusconfiguration.configurewithconnectionstring (NULL, config, connectionString);8 9 //Create serviceTenService = servicebusservice.create (config);
Operation Result:
1 for This connection string
Because of the simplicity of using the Azure Java SDK code, the full code is not posted here. Refer to Microsoft documentation for specific use.
Finally, the Microsoft Azure Java SDK has released 19 release versions since 2011, but in contrast, the. NET SDK has released 111 releases. What's a sad story ...
Initiate Thank you. Welcome to discuss together.
Best regards
Kevin Song
"My Microsoft Azure Learning Journey" Authentication issues for Azure Java Sdk-service bus