com.rabbitmq.client.ConsumerCancelledException Java Examples

The following examples show how to use com.rabbitmq.client.ConsumerCancelledException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RabbitMQConsumer.java    From storm-rabbitmq with MIT License 6 votes vote down vote up
public Message nextMessage() {
  reinitIfNecessary();
  if (consumerTag == null || consumer == null) return Message.NONE;
  try {
    return Message.forDelivery(consumer.nextDelivery(MS_WAIT_FOR_MESSAGE));
  } catch (ShutdownSignalException sse) {
    reset();
    logger.error("shutdown signal received while attempting to get next message", sse);
    reporter.reportError(sse);
    return Message.NONE;
  } catch (InterruptedException ie) {
    /* nothing to do. timed out waiting for message */
    logger.debug("interruepted while waiting for message", ie);
    return Message.NONE;
  } catch (ConsumerCancelledException cce) {
    /* if the queue on the broker was deleted or node in the cluster containing the queue failed */
    reset();
    logger.error("consumer got cancelled while attempting to get next message", cce);
    reporter.reportError(cce);
    return Message.NONE;
  }
}
 
Example #2
Source File: Spider.java    From jlitespider with Apache License 2.0 5 votes vote down vote up
public void begin() throws IOException, TimeoutException, ShutdownSignalException, 
                    ConsumerCancelledException, InterruptedException, SpiderSettingFileException{
	readSetting();
	logger.info("worker [" + this.settingObject.getWorkerid() + "] start...");
	for (Entry<String, MQRecver> recv : this.recvfromMap.entrySet()) {
		new Thread(new RecvThread(this, recv.getKey(), recv.getValue(), this.sendtoMap)).start();
	}
}
 
Example #3
Source File: MQRecver.java    From jlitespider with Apache License 2.0 4 votes vote down vote up
public MQItem recv() throws IOException, ShutdownSignalException, ConsumerCancelledException, InterruptedException {
	QueueingConsumer.Delivery delivery = consumer.nextDelivery();
	MQItem item = gson.fromJson(new String(delivery.getBody()), MQItem.class);
    channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
    return item;
}