Windows Azure Platform 2nd Edition Note 2
来源:互联网 发布:java分布式开源发框架 编辑:程序博客网 时间:2024/05/22 15:55
NamingService
-The Naming service allows youto assign DNS-capable names to your service, which makes the serviceeasilyresolvable over the Internet.
ServiceRegistry
-The AppFabric Service Busprovides a registration and discovery service for service endpoints called the serviceregistry.
classProgram
{
static void Main(string[] args)
{
ServiceHosthost = new ServiceHost(typeof(EnergyManagementService));
ServiceRegistrySettingssettings = new ServiceRegistrySettings();
settings.DiscoveryMode= DiscoveryType.Public;
foreach(ServiceEndpoints in host.Description.Endpoints)
s.Behaviors.Add(settings);
host.Open();
Console.WriteLine("Press[Enter] to exit");
Console.ReadLine();
host.Close();
}
}
The defaultsetting for the public discovery is set to private, so if you don’t set thediscovery type to
public, yourservice won’t be discoverable publicly
the serviceopens an outbound connection with a bidirectional socket to
theAppFabric Service Bus relay service.Note thatyou don’t need to open anyinbound ports in your firewall or NATrouter for the end-toend
communicationto work when using the AppFabric Service Bus. Therefore, the listenerapplication
can berunning behind a firewall, NAT router, and even with a dynamic IP address.Theclient
applicationinitiates an outbound connection to the relay service with the appropriateservice address
that can beresolved from the service registry. The AppFabric Service has a load-balancedarray of nodes
that providethe necessary scalability to the client and service communications. When theclient sends a
message tothe service, the message is relayed by the relay service to the appropriatenode that is holding
reference tothe listener’s endpoint. Finally, the relay service sends the message to theservice over the
listener’soutbound bidirectional socket.
AppFabricService Bus Bindings
Thefundamental difference between AppFabric Service Bus bindings and WCF bindingsis at the transport level, which is completely opaque to the programming model
MessageBuffer
TheAppFabric Service Bus bindings for the WCF-style communications aredesignedfor synchronous
communicationsbetween the sender and the receiver. This means the receiver must be running to receive themessage sent by the sender; otherwise, the message will get lost TheAppFabric Service Bus offers a message buffer service for storing messages in atemporary
cache forasynchronous communication between clients and servers.The messages stored in amessage buffer on the serverdon’t survive server reboots
Queues andTopics
Queuesprovide a durablemessaging mechanism, and Topics builds upon the queuing structure by adding theability to
createtopics for which consumers can create rules by which to filter messages
Note Queuesand Topics are replacing Message Buffers, which will be deprecated in futurereleases.
ProAzureEnergy Service Example
-Service Binding
-NetOnewayRelayBinding
-Relay Security
TransportClientEndpointBehaviorsharedSecretServiceBusCredential =
newTransportClientEndpointBehavior();
sharedSecretServiceBusCredential.CredentialType=
TransportClientCredentialType.SharedSecret;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName=
issuerName;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret=
issuerKey;
ServiceHostHost = new ServiceHost(serviceType);
Host.Description.Endpoints[0].Behaviors.Add(behavior);
-Message Security
Message security refers to thesecurity of the message as it travels from client to service via the AppFabric
Service Bus.As discussed earlier, the AppFabric Service Bus API offers four options formessage security
in theenumeration Microsoft.ServiceBus.EndToEndSecurityMode: None, Transport,Message, and
TransportWithMessageCredentials.netOnewayRelayBinding doesn’t support
TransportWithMessageCredentials.
-Service Endpoints
The endpoint
consists offour main attributes: the address of the endpoint, a binding that defines whatprotocol a
client canuse to communicate with the endpoint, a service contract that defines theoperations available
for theclient to call, and a set of behaviors defining the local behavior of theendpoint
<endpoint
address="sb://{yourservice namespace}
.servicebus.windows.net/OnewayEnergyServiceOperations/"
behaviorConfiguration="sharedSecretClientCredentials"
binding="netOnewayRelayBinding"
bindingConfiguration="default"
name="RelayEndpoint"
contract="EnergyServiceContract.IOnewayEnergyServiceOperations"/>
-Service Hosting
TransportClientEndpointBehaviorbehavior =
ServiceBusHelper.GetUsernamePasswordBehavior(issuerName,issuerKey);
Host = newServiceHost(typeof(OnewayEnergyServiceOperations));
Host.Description.Endpoints[0].Behaviors.Add(behavior);
Host.Open();
AppFabricMessaging: Queues and Topics
AppFabricService Bus Queues vs. Azure Storage Queues
So, what arethe differences, and when should each be used?AppFabric Queues provide a richer messaging environment in that it supportsprotocols other
than HTTP/S,in addition to enabling advanced messaging features:
• WCFbinding
• Poisonmessage handling
•Dead-lettering
• Transactions
• Groups
• Sessions
• duplicatedetection Message Deferral/Scheduled Delivery
•Authentication via ACS
Also, bothservices support REST over HTTP, but if you require a higher level ofperformance , you
can usebi-directional TCP with the AppFabric Queue
Another keydifference is that AppFabric Queues support the use ofsessions. With this, yougain the
ability toguarantee First-In First-Out ordering, as well as the ability to supportExactly-Once delivery
If any ofthe mentioned capabilities are required, you will need to use AppFabric Queues.If you
simply wantto use a queue to support cross-service communication, such as inter-rolecommunication
at scale,then AppFabric Queues could be overkill. In this case, Azure Storage Queuesshould be
sufficient.
**AddingSession State to a Queue
AppFabricService Bus Topics
HandlingProblem Messages and Abandonment
-Invalid/Poison Messages
-Server Error During MessageProcessing
- Windows Azure Platform 2nd Edition Note
- Windows Azure Platform 2nd Edition Note 2
- Windows Azure Platform体验(2):SQL Azure
- Windows Azure Learning Note (2)
- Note On <Programming Entity Framework 2nd Edition> -03
- Note On <Programming Entity Framework 2nd Edition> -04
- Note On <Programming Entity Framework 2nd Edition> -05
- Concrete Mathematics(2nd Edition) - A Note on Notation
- Windows Forms 2.0 Programming (2nd Edition)
- Learning Windows Server 2003, 2nd Edition
- Windows Forms 2.0 Programming (2nd Edition)
- Network Programming for Microsoft Windows 2nd Edition
- Inside Java 2 Platform Security: Architecture, API Design, and Implementation (2nd Edition)
- Applying Enterprise JavaBeans 2.1: Component-Based Development for the J2EE Platform (2nd Edition)
- [学习笔记]Thinking in Java (the 2nd edition) Study Note (2)
- [学习笔记]Thinking in Java (the 2nd edition) Study Note (2)
- [学习笔记]Thinking in Java (the 2nd edition) Study Note (1)
- [学习笔记]Thinking in Java (the 2nd edition) Study Note (1)
- Nuke里的包围曝光合成节点---BracketStacker (&source!)
- 根据模型的顶点位置坐标和纹理坐标计算顶点的法线、切线和副法线
- 基于OpenGL ES 的图片翻转例子,包含双面贴图3D变换
- 企业的潘多拉-管理篇
- MFC 更改默认窗口大小的方法
- Windows Azure Platform 2nd Edition Note 2
- HTTP Error 500.19 – 内部服务器错误”的解决方法
- 收到了CSDN送的一本杂志和日历
- 第七章 菜单和工具栏 总结
- 雅昌数据系统及应用系统构建方案---之一:基础体系架构
- 死锁的监控
- POJ2892 HDU 1540 Tunnel Warfare, 树状数组
- windows7系统笔记本设置成虚拟WiFi热点(即“无线路由器”)
- 投资圣经(让历史鉴证未来)