Microsoft Azure Java Usage Demo

简介

借助 Microsoft Azure Cloud Service,Storage,SQL Database ,Service Bus构建的简单web示例程序,程序分为两个模块,笔记管理和全文检索。笔记管理模块简单实现了类似于有道笔记的笔记管理功能,笔记中支持富文本编辑和图片上传的功能。笔记数据存储于Database ,图片及其富文本内容存储于Storage Blob Container。在添加笔记的同时,还会发送消息给Service Bus,全文检索模块会订阅Service Bus 消息队列的消息,将添加,修改的笔记同步到Lucene索引库。

Microsoft Azure Java Usage Demo_第1张图片

演示

Microsoft Azure Java Usage Demo_第2张图片

源码

下载编译

clone azure-demo 代码

git clone https://github.com/chenrui1988/azure-demo.git

修改 azure.properties

修改文件lib/src/main/resources/azure.propertie ,将配置修改为自己创建的Database ,Storage, Service Bus

#azure database config
azure.db.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
azure.db.url=jdbc:sqlserver://g2ifiab1sg.database.chinacloudapi.cn:1433;database=kevindb;useunicode=true;characterEncoding=UTF-8
azure.db.username=kevindb@g2ifiab1sg
azure.db.password=Chenrui1

#azure storage connection string
azure.storage.protocol=http
azure.storage.account=kevinstorage
azure.storage.accesskey=8/NNYYenkXlOmXRZ8zBjpzSLkBKyYoIk/EKr1KShiDrT8bR34/jPccPgHMUE9K1sdQnt0rdqdQHRSahiAefxwQ==
azure.storage.storageRootUri=core.chinacloudapi.cn

#azure service bus config
azure.servicebus.username=RootManageSharedAccessKey
azure.servicebus.password=p1uVVxPQLDfXDN3OnIsG14p9L18pKVqVb+kLrwpnupQ=
azure.servicebus.host=kevinbus.servicebus.chinacloudapi.cn
azure.servicebus.queue=queue1
azure.servicebus.topic=topic1

编译代码
修改完属性文件后,回到 azure-demo目录下,执行:

mvn clean install 

导入Eclipse

导入之前注意:
1. 请执行一遍 mvn clean install
2. 安装 Eclipse Azure Plugin.

直接File - Import - Maven - Exsitting Maven Projects。导入之前请执行一遍 mvn clean install
Microsoft Azure Java Usage Demo_第3张图片

部署到Azure

部署前,请创建程序所需要的storage,service bus,sql database。之后修改 lib/src/main/resources/azure.propertie配置。

导入项目后,选择web项目 右键Azure - Publish to Azure
Microsoft Azure Java Usage Demo_第4张图片

导入publishsettings文件,选择Subscription, Storage, Cloud Service. 点击publish
Microsoft Azure Java Usage Demo_第5张图片

注意:web项目选择 Service kevinapp ,search 选择 Service kevinvm。先部署web, 然后部署search 项目

部署完成直接访问:http://kevinapp.chinacloudapp.cn/web

相关文档:
Use AMQP with Microsoft Azure Service Bus Queue
https://azure.microsoft.com/en-us/develop/java/
http://www.windowsazure.cn/starter-guide/
https://azure.microsoft.com/en-us/get-started/

你可能感兴趣的:(Microsoft Azure Java Usage Demo)