ppat / storm-rabbitmq

A library of tools for interacting with RabbitMQ from Storm.
MIT License
126 stars 77 forks source link

Support for activate and deactivate methods in RabbitMQSpout #17

Closed arinto closed 9 years ago

arinto commented 9 years ago

The io.latent.storm.rabbitmq.RabbitMQSpout class doesn't override BaseRichSpout activate and deactivate methods.

Here's my proposal

  @Override
  public void activate() {
    logger.info("activating spout!");
    consumer = loadConsumer(declarator, reporter, consConfig);
    scheme.open(topoConfig, topoContext);
    consumer.open();
    super.activate();
  }

We will cache topoConfig and topoContext from the open method.

 @Override
  public void deactivate() {
    logger.info("deactivating spout!");
    consumer.close();
    scheme.close();
    consumer = null;
    super.deactivate();
  }

I'll update this issue with my code in my development branch once it finishes

ppat commented 9 years ago

Makes sense. This would be very useful, once you get it working, we would love a pull request.

On Oct 15, 2014, at 2:36 AM, Arinto Murdopo notifications@github.com wrote:

The io.latent.storm.rabbitmq.RabbitMQSpout class doesn't override BaseRichSpout activate and deactivate methods.

Here's my proposal

  1. activate method will contains these code snippet:

    @Override public void activate() { scheme.open(topoConfig, topoContext); consumer.open(); super.activate(); } We will cache topoConfig and topoContext from the open method.

deactivate method is following @Override public void deactivate() { consumer.close(); scheme.close(); super.deactivate(); } I'll update this issue with my code in my development branch once it finishes

— Reply to this email directly or view it on GitHub.

ppat commented 9 years ago

Closed by 0e438a383cd2187c66a94f933861a85663fd5eed