Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Introducing Windows Azure- P40:The cloud platform is getting more and more attractive to the computing world. Today, service-oriented architecture (SOA) and aspect-oriented programming (AOP) techniques are widely used in enterprise solutions. A question an IT management team or a software development team may ask is, what is the next trend going to be? Cloud computing seems to be the right answer. | CHAPTER 6 AZURE .NET SERVICES SERVICE BUS status is initially set to relay binding and will be automatically switched to direct binding a few seconds after the connection has been established. Listing 6-8. Implementation ofConsole Application Instantiates a Connection Starting with Relay Service using System using System.ServiceModel using Microsoft.ServiceBus using System.Text using System.Configuration namespace SoftnetSolutions.RelayService.PublishChannel using SoftnetSolutions.RelayService.ServiceContract class Program static void Main string args PublishEventService service new PublishEventService string endpoint RelayEndpoint HybridPublishService hybridPublishService new HybridPublishService endpoint Console.WriteLine string.Format Relay connection has been established----- 0 Environment.NewLine IHybridConnectionStatus hybridConnectionStatus hybridPublishService.ClientChannel.GetProperty IHybridConnectionStatus hybridConnectionStatus.ConnectionStateChanged new EventHandler HybridConnectionStateChangedArgs hybridConnectionStatus ConnectionStateChanged Console.WriteLine string.Format Press Enter to exit publishing---- 0 Environment.NewLine string input Console.ReadLine while input String.Empty PostData postData new PostData postData.Message string.Format 0 1 DateTime.Now.ToString input hybridPublishService.ClientChannel as IPublishEventService .PostMessage postData 188 CHAPTER 6 AZURE .NET SERVICES SERVICE BUS input Console.ReadLine hybridPublishService.ClientChannel.Dispose static private void hybridConnectionStatus ConnectionStateChanged object sender HybridConnectionStateChangedArgs args Console.WriteLine string.Format Connection has been switched from relay to direct connection 0 Environment.NewLine The screenshot of Figure 6-7 caught at the breakpoint from Visual Studio shows that the connection type is relayed when the connection is established. Figure 6-8 shows that the connection has been automatically switched to direct a few seconds later and that a .