def send_many(n):

    #: Create connection
    #: If hostname, userid, password and virtual_host is not specified
    #: the values below are the default, but listed here so it can
    #: be easily changed.
    with Connection('amqp://guest:guest@localhost:5672//') as connection:

        #: SimpleQueue mimics the interface of the Python Queue module.
        #: First argument can either be a queue name or a kombu.Queue object.
        #: If a name, then the queue will be declared with the name as the
        #: queue name, exchange name and routing key.
        with connection.SimpleQueue('kombu_demo') as queue:

            def send_message(i):
                queue.put({'hello': 'world%s' % (i,)})

            pool = eventlet.GreenPool(10)
            for i in range(n):
                pool.spawn(send_message, i)
            pool.waitall()
dataset/ETHPy150Open celery/kombu/examples/simple_eventlet_send.py/send_many/original