Class RabbitMQConsumer
java.lang.Object
org.wso2.carbon.inbound.endpoint.protocol.rabbitmq.RabbitMQConsumer
- All Implemented Interfaces:
com.rabbitmq.client.Consumer
The actual tasks that perform message consuming
-
Constructor Summary
ConstructorsConstructorDescriptionRabbitMQConsumer(RabbitMQConnectionFactory rabbitMQConnectionFactory, Properties properties, RabbitMQInjectHandler injectHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Return connection back to the pool when undeploying the listener proxyvoidexecute()Execute by theRabbitMQTaskvoidhandleCancel(String consumerTag) Called when the consumer is cancelled for reasons other than by a call toChannel.basicCancel(java.lang.String).voidhandleCancelOk(String consumerTag) Called when the consumer is cancelled by a call toChannel.basicCancel(java.lang.String).voidhandleConsumeOk(String consumerTag) Called when the consumer is registered by a call to any of theChannel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer)methods.voidhandleDelivery(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.voidhandleRecoverOk(String consumerTag) Called when a basic.recover-ok is received in reply to a basic.recover.voidhandleShutdownSignal(String consumerTag, com.rabbitmq.client.ShutdownSignalException signal) Called when either the channel or the underlying connection has been shut down.voidsetInboundName(String inboundName)
-
Constructor Details
-
RabbitMQConsumer
public RabbitMQConsumer(RabbitMQConnectionFactory rabbitMQConnectionFactory, Properties properties, RabbitMQInjectHandler injectHandler)
-
-
Method Details
-
execute
public void execute()Execute by theRabbitMQTask -
handleConsumeOk
Called when the consumer is registered by a call to any of theChannel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer)methods.- Specified by:
handleConsumeOkin interfacecom.rabbitmq.client.Consumer- Parameters:
consumerTag- the consumer tag associated with the consumer
-
handleCancelOk
Called when the consumer is cancelled by a call toChannel.basicCancel(java.lang.String).- Specified by:
handleCancelOkin interfacecom.rabbitmq.client.Consumer- Parameters:
consumerTag- the consumer tag associated with the consumer
-
handleCancel
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:
handleCancelin 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:
handleShutdownSignalin interfacecom.rabbitmq.client.Consumer- Parameters:
consumerTag- the consumer tag associated with the consumersignal- aShutdownSignalExceptionindicating the reason for the shut down
-
handleRecoverOk
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:
handleRecoverOkin 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:
handleDeliveryin 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:
-
close
public void close()Return connection back to the pool when undeploying the listener proxy -
getInboundName
-
setInboundName
-