# File lib/stomp_server/queue_manager.rb, line 87
  def send_a_backlog(connection)
    puts "Sending a backlog" if $DEBUG
    # lookup queues with data for this connection
    possible_queues = @queues.select{ |destination,users|
      @qstore.message_for?(destination) &&
        users.detect{|u| u.connection == connection}
    }
    if possible_queues.empty?
      puts "Nothing left" if $DEBUG
      return
    end
    # Get a random one (avoid artificial priority between queues
    # without coding a whole scheduler, which might be desirable later)
    dest,users = possible_queues[rand(possible_queues.length)]
    user = users.find{|u| u.connection == connection}
    frame = @qstore.dequeue(dest)
    puts "Chose #{dest}" if $DEBUG
    send_to_user(frame, user)
  end