public abstract class AbstractMessageConsumer extends com.rabbitmq.client.DefaultConsumer implements MessageConsumer
| Modifier and Type | Field and Description |
|---|---|
protected com.rabbitmq.client.Channel |
channel
The channel of the queue from which the incoming messages will be
consumed.
|
private Semaphore |
currentlyProcessedMessages
Semaphore used to control the number of messages that can be processed in
parallel.
|
static int |
DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES
Default value of the
maxParallelProcessedMsgs attribute. |
private static org.slf4j.Logger |
LOGGER |
private int |
maxParallelProcessedMsgs
The maximum number of incoming messages that are processed in parallel.
|
protected String |
name |
protected DataReceiver |
receiver
The
DataReceiver which is using this consumer. |
| Constructor and Description |
|---|
AbstractMessageConsumer(DataReceiver receiver,
com.rabbitmq.client.Channel channel,
int maxParallelProcessedMsgs,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
finishProcessing() |
abstract int |
getOpenStreamCount() |
void |
handleDelivery(String consumerTag,
com.rabbitmq.client.Envelope envelope,
com.rabbitmq.client.AMQP.BasicProperties properties,
byte[] body) |
protected abstract boolean |
handleMessage(com.rabbitmq.client.AMQP.BasicProperties properties,
byte[] body) |
void |
waitForTermination() |
getChannel, getConsumerTag, handleCancel, handleCancelOk, handleConsumeOk, handleRecoverOk, handleShutdownSignalclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprivate static final org.slf4j.Logger LOGGER
public static final int DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES
maxParallelProcessedMsgs attribute.private final int maxParallelProcessedMsgs
private Semaphore currentlyProcessedMessages
protected DataReceiver receiver
DataReceiver which is using this consumer.protected com.rabbitmq.client.Channel channel
protected String name
public AbstractMessageConsumer(DataReceiver receiver, com.rabbitmq.client.Channel channel, int maxParallelProcessedMsgs, String name)
public void handleDelivery(String consumerTag, com.rabbitmq.client.Envelope envelope, com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body) throws IOException
handleDelivery in interface com.rabbitmq.client.ConsumerhandleDelivery in class com.rabbitmq.client.DefaultConsumerIOExceptionprotected abstract boolean handleMessage(com.rabbitmq.client.AMQP.BasicProperties properties,
byte[] body)
throws IOException
IOExceptionpublic void finishProcessing()
throws InterruptedException
finishProcessing in interface MessageConsumerInterruptedExceptionpublic abstract int getOpenStreamCount()
getOpenStreamCount in interface MessageConsumerpublic void waitForTermination()
waitForTermination in interface MessageConsumerCopyright © 2017–2018. All rights reserved.