Open jredl-va opened 5 years ago
@jredl-va this is a great idea. Ack/Nack members can be added to your RabbitMQ Storage
class. What do you think?
@asciimoo my apologies for the delayed response, I missed your comment somewhere along the way.
That feels like something that would work, and would allow configurability against different storage implementations.
@jredl-va Cool, I also want to implement the colly.queue with rabbitmq,and the Ack/NAck can not be done when the OnHtml finished.Do u have any good idea ?
I suggest to add a Ack method to the storage interface. Both rabbitmq and redis as storage backend need to commit the job is done successfully ,otherwise the issued URL need to re-push into the queue and try again.
I suggest to add a Ack method to the storage interface. Both rabbitmq and redis as storage backend need to commit the job is done successfully ,otherwise the issued URL need to re-push into the queue and try again.
I'd keep these functions outside of the interface, because not all the backends needs them.
@asciimoo for your consideration. I've been somewhat frustrated with leveraging redis as a queue. Even though it has queue like capabilities I've found it lacking. Here is a rabbitmq based storage I would like to propose as another storage option.
On the rabbitmq front, have you given any consideration at all about adding an additional hook into the queue or the colly callbacks to be able to "ack" or "nack" a message envelop( task or pubsub for example)?
I've been considering a pull request that opens up the ability to unmarshall a request within a queues GetRequest method: https://github.com/gocolly/colly/blob/master/queue/queue.go#L142
This would allow me to place a msg envelope (for example a rabbitmq tasks) onto a request that in turn within the colly callbacks I could
ack
on success ornack
in the event of an error. Currently I'm "auto acking" tasks but this can cause tasks to leak in the event of a non graceful shutdown of a collector.