Class: AhisAzureQueue
- Inherits:
-
Object
- Object
- AhisAzureQueue
- Defined in:
- lib/ahis_azure_queue.rb
Class Method Summary collapse
-
.config_access_azure_storage(storage_account_name, storage_access_key) ⇒ Object
this method will configure Azure Storage Queue.
- .create ⇒ Object
-
.create_a_queue(queue_name) ⇒ Object
For creating queue if not already exists from Azure Storage.
-
.delete_queue(queue_name) ⇒ Object
For deleting queue from Azure Storage.
-
.read_instruction(queue_name) ⇒ Object
this method will read instrution to the Azure Queue.
-
.send_instruction(queue_name, instruct) ⇒ Object
this method will send instrution to the Azure Queue.
Instance Method Summary collapse
-
#initialize ⇒ AhisAzureQueue
constructor
Initialize of azure Queue Service.
Constructor Details
#initialize ⇒ AhisAzureQueue
Initialize of azure Queue Service
10 11 12 |
# File 'lib/ahis_azure_queue.rb', line 10 def initialize @@azure_queue_service = Azure::QueueService.new end |
Class Method Details
.config_access_azure_storage(storage_account_name, storage_access_key) ⇒ Object
this method will configure Azure Storage Queue
65 66 67 68 |
# File 'lib/ahis_azure_queue.rb', line 65 def self.config_access_azure_storage(storage_account_name,storage_access_key) Azure.config.storage_account_name = storage_account_name Azure.config.storage_access_key = storage_access_key end |
.create ⇒ Object
14 15 16 |
# File 'lib/ahis_azure_queue.rb', line 14 def self.create AhisAzureQueue.new end |
.create_a_queue(queue_name) ⇒ Object
For creating queue if not already exists from Azure Storage
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ahis_azure_queue.rb', line 24 def self.create_a_queue(queue_name) queues_to_be_created = Array.new existing_queues = @@azure_queue_service.list_queues() existing_queues.each do |q| queues_to_be_created << q.name end if queues_to_be_created.include? queue_name #no need to execute else #else create a new queue @@azure_queue_service.create_queue(queue_name) end end |
.delete_queue(queue_name) ⇒ Object
For deleting queue from Azure Storage
19 20 21 |
# File 'lib/ahis_azure_queue.rb', line 19 def self.delete_queue(queue_name) @@azure_queue_service.delete_queue(queue_name) end |
.read_instruction(queue_name) ⇒ Object
this method will read instrution to the Azure Queue
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ahis_azure_queue.rb', line 48 def self.read_instruction(queue_name) instruction_array=[] , = @@azure_queue_service.(queue_name) puts while !=0 do = @@azure_queue_service.(queue_name,30) .each do |m| puts m. instruction_array<<m. @@azure_queue_service.(queue_name,m.id, m.pop_receipt) =-1 end end return instruction_array end |
.send_instruction(queue_name, instruct) ⇒ Object
this method will send instrution to the Azure Queue
43 44 45 |
# File 'lib/ahis_azure_queue.rb', line 43 def self.send_instruction(queue_name,instruct) @@azure_queue_service.(queue_name, instruct) end |