|  | @@ -397,13 +397,22 @@ class Consumer(object):
 | 
	
		
			
				|  |  |              self.pool.flush()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def connect(self):
 | 
	
		
			
				|  |  | -        """Establish the broker connection.
 | 
	
		
			
				|  |  | +        """Establish the broker connection used for consuming tasks.
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Retries establishing the connection if the
 | 
	
		
			
				|  |  |          :setting:`broker_connection_retry` setting is enabled
 | 
	
		
			
				|  |  |          """
 | 
	
		
			
				|  |  | -        conn = self.app.connection_for_read(heartbeat=self.amqheartbeat)
 | 
	
		
			
				|  |  | +        return self.connection_for_read(heartbeat=self.amqheartbeat)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    def connection_for_read(self, heartbeat=None):
 | 
	
		
			
				|  |  | +        return self.ensure_connected(
 | 
	
		
			
				|  |  | +            self.app.connection_for_read(heartbeat=heartbeat))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    def connection_for_write(self, heartbeat=None):
 | 
	
		
			
				|  |  | +        return self.ensure_connected(
 | 
	
		
			
				|  |  | +            self.app.connection_for_write(heartbeat=heartbeat))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    def ensure_connected(self, conn):
 | 
	
		
			
				|  |  |          # Callback called for each retry while the connection
 | 
	
		
			
				|  |  |          # can't be established.
 | 
	
		
			
				|  |  |          def _error_handler(exc, interval, next_step=CONNECTION_RETRY_STEP):
 | 
	
	
		
			
				|  | @@ -427,6 +436,7 @@ class Consumer(object):
 | 
	
		
			
				|  |  |              conn.transport.register_with_event_loop(conn.connection, self.hub)
 | 
	
		
			
				|  |  |          return conn
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      def _flush_events(self):
 | 
	
		
			
				|  |  |          if self.event_dispatcher:
 | 
	
		
			
				|  |  |              self.event_dispatcher.flush()
 |