Created
October 30, 2014 20:43
-
-
Save fixxer/aa3c70f04525fa3a91ab to your computer and use it in GitHub Desktop.
Microsoft Azure ServiceBus example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.microsoft.windowsazure.services.core.Configuration; | |
import com.microsoft.windowsazure.services.core.ServiceException; | |
import com.microsoft.windowsazure.services.serviceBus.ServiceBusConfiguration; | |
import com.microsoft.windowsazure.services.serviceBus.ServiceBusContract; | |
import com.microsoft.windowsazure.services.serviceBus.ServiceBusService; | |
import com.microsoft.windowsazure.services.serviceBus.models.BrokeredMessage; | |
import com.microsoft.windowsazure.services.serviceBus.models.CreateQueueResult; | |
import com.microsoft.windowsazure.services.serviceBus.models.QueueInfo; | |
/** | |
* Hello world! | |
*/ | |
public class App { | |
public static void main(String[] args) { | |
String issuer = "owner"; | |
String key = "your key"; | |
Configuration config = | |
ServiceBusConfiguration.configureWithWrapAuthentication( | |
"your service", | |
issuer, | |
key, | |
".servicebus.windows.net", | |
"-sb.accesscontrol.windows.net/WRAPv0.9"); | |
ServiceBusContract service = ServiceBusService.create(config); | |
QueueInfo queueInfo = new QueueInfo("TestQueue"); | |
try { | |
CreateQueueResult result = service.createQueue(queueInfo); | |
BrokeredMessage message = new BrokeredMessage("sendMessageWorks"); | |
service.sendQueueMessage("TestQueue", message); | |
} catch (ServiceException e) { | |
System.out.print("ServiceException encountered: "); | |
System.out.println(e.getMessage()); | |
System.exit(-1); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>com.microsoft.windowsazure</groupId> | |
<artifactId>microsoft-windowsazure-api</artifactId> | |
<version>0.3.3</version> | |
</dependency> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment