rabbitmq / rabbitmq-recent-history-exchange

RabbitMQ Recent History Exchange
Other
82 stars 21 forks source link

consumer stuck after receiving 100000 msg #28

Closed sl624 closed 4 years ago

sl624 commented 7 years ago

publisher publish 1000000 msg. consumer starts later to receive the msg. it hangs after 100000 msgs. Code shown below:

Publisher

args={'x-recent-history-length':1000000}
channel.exchange_declare(exchange='buffer', exchange_type='x-recent-history', arguments =args)
for i in range(1000000):
    message = datetime.now().strftime("%H:%M:%S") + '.' + str(i)
    channel.basic_publish(exchange='buffer',
                          routing_key='',
                          body=message)

Consumer

channel.exchange_declare(exchange='buffer', exchange_type='x-recent-history')
result = channel.queue_declare(exclusive=True)
queue_name = result.method.queue
channel.queue_bind(exchange='buffer',
                   queue=queue_name)
print(' [*] Waiting for buffer. To exit press CTRL+C')

def callback(ch, method, properties, body):
    msg_id = int (body.split('.')[1])
    if msg_id % 10000 == 0:
        print(" [x] %s:  %r" % (datetime.now().strftime("%H:%M:%S"),body))

Note: this might be related to issue #27

lukebakken commented 4 years ago

Closing due to inactivity.