Commits

Michael Granger  committed b30f07c

Update the TO-DO list

  • Participants
  • Parent commits 7c4d92d

Comments (0)

Files changed (3)

 
-[ ] Update pinger/ssh/sshscript
 [ ] Per Task throttling for daemon
 [ ] Task scaling (min/max settings), check queue backlog during received message

File lib/symphony/queue.rb

 		heartbeat:   'server',
 	}
 
+	# Arguments to use when creating the consumer
+	CONSUMER_ARGS = {
+		'x-cancel-on-ha-failover' => true,
+	}
+
 	# The default number of messages to prefetch
 	DEFAULT_PREFETCH = 10
 
 		# Last argument is *no_ack*, so need to invert the logic
 		self.log.debug "Creating consumer for the '%s' queue with tag: %s" %
 			[ amqp_queue.name, tag ]
-		cons = Bunny::Consumer.new( amqp_queue.channel, amqp_queue, tag, !ackmode, false,
-			'x-cancel-on-ha-failover' => true )
+		cons = Bunny::Consumer.new( amqp_queue.channel, amqp_queue, tag, !ackmode, false, CONSUMER_ARGS )
 
 		cons.on_delivery do |delivery_info, properties, payload|
 			rval = self.handle_message( delivery_info, properties, payload, &work_callback )

File spec/symphony/queue_spec.rb

 				with( Symphony::Queue::DEFAULT_PREFETCH )
 
 			expect( Bunny::Consumer ).to receive( :new ).
-				with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false ).
+				with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false, false,
+				      Symphony::Queue::CONSUMER_ARGS ).
 				and_return( consumer )
 
 			# Set up an artificial method to call the delivery callback that we can later
 			expect( described_class.amqp_channel ).to receive( :prefetch ).with( 1 )
 
 			expect( Bunny::Consumer ).to receive( :new ).
-				with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false ).
+				with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false, false,
+				      Symphony::Queue::CONSUMER_ARGS ).
 				and_return( consumer )
 
 			expect( consumer ).to receive( :on_delivery ) do |&block|
 				with( Symphony::Queue::DEFAULT_PREFETCH )
 
 			expect( Bunny::Consumer ).to receive( :new ).
-				with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false ).
+				with( described_class.amqp_channel, amqp_queue, queue.consumer_tag, false, false,
+				      Symphony::Queue::CONSUMER_ARGS ).
 				and_return( consumer )
 
 			expect( consumer ).to receive( :on_delivery )
 
 			# Ackmode argument is actually 'no_ack'
 			expect( Bunny::Consumer ).to receive( :new ).
-				with( amqp_channel, amqp_queue, queue.consumer_tag, false ).
+				with( amqp_channel, amqp_queue, queue.consumer_tag, false, false,
+				      Symphony::Queue::CONSUMER_ARGS ).
 				and_return( consumer )
 			expect( consumer ).to receive( :on_delivery )
 			expect( consumer ).to receive( :on_cancellation )
 			# Ackmode argument is actually 'no_ack'
 			queue.instance_variable_set( :@acknowledge, false )
 			expect( Bunny::Consumer ).to receive( :new ).
-				with( amqp_channel, amqp_queue, queue.consumer_tag, true ).
+				with( amqp_channel, amqp_queue, queue.consumer_tag, true, false,
+				      Symphony::Queue::CONSUMER_ARGS ).
 				and_return( consumer )
 			expect( consumer ).to receive( :on_delivery )
 			expect( consumer ).to receive( :on_cancellation )