Communication between the components of a distributed

  • No School
  • AA 1
  • TiZonBE
  • 187
  • 100% (4) 4 out of 4 people found this document helpful

This preview shows page 49 - 53 out of 187 pages.

Communication between the components of a distributed application running on-premises in different organizations or departments of an organization. Using queues enables you to scale your applications more easily and enables more resiliency in your architecture. MCT USE ONLY. STUDENT USE PROHIBITED
Create and configure a service bus 45 Manipulating a Service Bus queue using Ruby To use Service Bus, you will first need to download and use the Azure Ruby package, which includes a set of convenience libraries that communicate with the storage representational state transfer (REST) services. The easiest way to accomplish this is to install the gem and dependencies: gem install azure At the top of any Ruby file where you want to use the Azure Ruby libraries, you need to include the azure directive: require "azure" To create a connection to Service Bus using the client object, use the following code to set the values of the namespace, key name, key, signer, and host: Azure.configure do |config| config.sb_namespace = '<your azure service bus namespace>' config.sb_sas_key_name = '<your azure service bus access keyname>' config.sb_sas_key = '<your azure service bus access key>' end signer = Azure::ServiceBus::Auth::SharedAccessSigner.new sb_host = "{Azure.sb_namespace}.servicebus.windows.net" The Azure::ServiceBusService object enables you to work with queues. To create a queue, use the create_queue() method. The following example cre- ates a queue or prints out any errors: azure_service_bus_service = Azure::ServiceBus::ServiceBusService.new(sb_ host, { signer: signer}) begin queue = azure_service_bus_service.create_queue("test-queue") rescue puts $! end To send a message to a Service Bus queue, your application calls the send_queue_message() method on the Azure::ServiceBusService object. Messages sent to (and received from) Service Bus queues are Azure::ServiceBus::BrokeredMessage objects and have a set of standard properties (such as label and time_to_live ); a dictionary that is used to hold custom, application-specific properties; and a body of arbitrary application data. An application can set the body of the message by passing a string value as the message, and any required standard properties are populated with default values. The following example demonstrates how to send a test message to the queue named test-queue using send_queue_message() : message = Azure::ServiceBus::BrokeredMessage.new("test queue message") message.correlation_id = "test-correlation-id" MCT USE ONLY. STUDENT USE PROHIBITED
46 Module 2 Module Configuring a Message-Based Integration Architecture azure_service_bus_service.send_queue_message("test-queue", message) MCT USE ONLY. STUDENT USE PROHIBITED
Configuring apps and services with Microsoft Graph 47 Configuring apps and services with Microsoft Graph Microsoft Graph Microsoft Graph is the gateway to data and intelligence in Microsoft 365.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture