Class RabbitMQConsumer
- java.lang.Object
-
- org.apache.synapse.message.store.impl.rabbitmq.RabbitMQConsumer
-
- All Implemented Interfaces:
MessageConsumer
public class RabbitMQConsumer extends Object implements MessageConsumer
The message consumer responsible for read a message from the queue and set it into the message context
-
-
Constructor Summary
Constructors Constructor Description RabbitMQConsumer(RabbitMQStore store)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanack()Acknowledge the message upon successful backend invocationbooleancleanup()Cleanup theConnectionand it's related resourcesStringgetId()Get ID of this RabbitMQ consumerbooleanisAlive()Check availability of connectivity with the message storeMessageContextreceive()Get a single message from the queue and deserialize for set into the message contextvoidsetAlive(boolean isAlive)Set availability of connectivity with the message storevoidsetChannel(com.rabbitmq.client.Channel channel)Set theChannelobjectvoidsetConnection(com.rabbitmq.client.Connection connection)Set theConnectionobjectvoidsetId(int id)Set ID of this RabbitMQ consumervoidsetQueueName(String queueName)Set the queue name
-
-
-
Constructor Detail
-
RabbitMQConsumer
public RabbitMQConsumer(RabbitMQStore store)
-
-
Method Detail
-
receive
public MessageContext receive()
Get a single message from the queue and deserialize for set into the message context- Specified by:
receivein interfaceMessageConsumer- Returns:
- the
MessageContextwith received message
-
ack
public boolean ack()
Acknowledge the message upon successful backend invocation- Specified by:
ackin interfaceMessageConsumer- Returns:
- whether message is successfully acknowledge or not
-
cleanup
public boolean cleanup()
Cleanup theConnectionand it's related resources- Specified by:
cleanupin interfaceMessageConsumer- Returns:
- whether cleanup successful or not
-
isAlive
public boolean isAlive()
Check availability of connectivity with the message store- Specified by:
isAlivein interfaceMessageConsumer- Returns:
trueif connection available,falseotherwise.
-
setAlive
public void setAlive(boolean isAlive)
Set availability of connectivity with the message store- Specified by:
setAlivein interfaceMessageConsumer- Parameters:
isAlive- connection availability.
-
getId
public String getId()
Get ID of this RabbitMQ consumer- Specified by:
getIdin interfaceMessageConsumer- Returns:
- the ID
-
setId
public void setId(int id)
Set ID of this RabbitMQ consumer- Specified by:
setIdin interfaceMessageConsumer- Parameters:
id- ID
-
setConnection
public void setConnection(com.rabbitmq.client.Connection connection)
Set theConnectionobject- Parameters:
connection- aConnectionobject
-
setChannel
public void setChannel(com.rabbitmq.client.Channel channel)
Set theChannelobject- Parameters:
channel- aChannelobject
-
setQueueName
public void setQueueName(String queueName)
Set the queue name- Parameters:
queueName- the queue name
-
-