Class RabbitMQConsumer
- java.lang.Object
-
- org.wso2.carbon.inbound.endpoint.protocol.rabbitmq.RabbitMQConsumer
-
- All Implemented Interfaces:
com.rabbitmq.client.Consumer
public class RabbitMQConsumer extends Object implements com.rabbitmq.client.Consumer
The actual tasks that perform message consuming
-
-
Constructor Summary
Constructors Constructor Description RabbitMQConsumer(RabbitMQConnectionFactory rabbitMQConnectionFactory, Properties properties, RabbitMQInjectHandler injectHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Return connection back to the pool when undeploying the listener proxyvoid
execute()
Execute by theRabbitMQTask
String
getInboundName()
void
handleCancel(String consumerTag)
Called when the consumer is cancelled for reasons other than by a call toChannel.basicCancel(java.lang.String)
.void
handleCancelOk(String consumerTag)
Called when the consumer is cancelled by a call toChannel.basicCancel(java.lang.String)
.void
handleConsumeOk(String consumerTag)
Called when the consumer is registered by a call to any of theChannel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer)
methods.void
handleDelivery(String consumerTag, com.rabbitmq.client.Envelope envelope, com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body)
Called when a basic.deliver is received for this consumer.void
handleRecoverOk(String consumerTag)
Called when a basic.recover-ok is received in reply to a basic.recover.void
handleShutdownSignal(String consumerTag, com.rabbitmq.client.ShutdownSignalException signal)
Called when either the channel or the underlying connection has been shut down.void
setInboundName(String inboundName)
-
-
-
Constructor Detail
-
RabbitMQConsumer
public RabbitMQConsumer(RabbitMQConnectionFactory rabbitMQConnectionFactory, Properties properties, RabbitMQInjectHandler injectHandler)
-
-
Method Detail
-
execute
public void execute()
Execute by theRabbitMQTask
-
handleConsumeOk
public void handleConsumeOk(String consumerTag)
Called when the consumer is registered by a call to any of theChannel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer)
methods.- Specified by:
handleConsumeOk
in interfacecom.rabbitmq.client.Consumer
- Parameters:
consumerTag
- the consumer tag associated with the consumer
-
handleCancelOk
public void handleCancelOk(String consumerTag)
Called when the consumer is cancelled by a call toChannel.basicCancel(java.lang.String)
.- Specified by:
handleCancelOk
in interfacecom.rabbitmq.client.Consumer
- Parameters:
consumerTag
- the consumer tag associated with the consumer
-
handleCancel
public void handleCancel(String consumerTag) throws IOException
Called when the consumer is cancelled for reasons other than by a call toChannel.basicCancel(java.lang.String)
. For example, the queue has been deleted. SeehandleCancelOk(java.lang.String)
for notification of consumer cancellation due toChannel.basicCancel(java.lang.String)
.- Specified by:
handleCancel
in interfacecom.rabbitmq.client.Consumer
- Parameters:
consumerTag
- the consumer tag associated with the consumer- Throws:
IOException
-
handleShutdownSignal
public void handleShutdownSignal(String consumerTag, com.rabbitmq.client.ShutdownSignalException signal)
Called when either the channel or the underlying connection has been shut down.- Specified by:
handleShutdownSignal
in interfacecom.rabbitmq.client.Consumer
- Parameters:
consumerTag
- the consumer tag associated with the consumersignal
- aShutdownSignalException
indicating the reason for the shut down
-
handleRecoverOk
public void handleRecoverOk(String consumerTag)
Called when a basic.recover-ok is received in reply to a basic.recover. All messages received before this is invoked that haven't been ack'ed will be re-delivered. All messages received afterwards won't be.- Specified by:
handleRecoverOk
in interfacecom.rabbitmq.client.Consumer
- Parameters:
consumerTag
- the consumer tag associated with the consumer
-
handleDelivery
public void handleDelivery(String consumerTag, com.rabbitmq.client.Envelope envelope, com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body) throws IOException
Called when a basic.deliver is received for this consumer.- Specified by:
handleDelivery
in interfacecom.rabbitmq.client.Consumer
- Parameters:
consumerTag
- the consumer tag associated with the consumerenvelope
- packaging data for the messageproperties
- content header data for the messagebody
- the message body (opaque, client-specific byte array)- Throws:
IOException
- if the consumer encounters an I/O error while processing the message- See Also:
Envelope
-
close
public void close()
Return connection back to the pool when undeploying the listener proxy
-
getInboundName
public String getInboundName()
-
setInboundName
public void setInboundName(String inboundName)
-
-