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 boolean
ack()
Acknowledge the message upon successful backend invocationboolean
cleanup()
Cleanup theConnection
and it's related resourcesString
getId()
Get ID of this RabbitMQ consumerboolean
isAlive()
Check availability of connectivity with the message storeMessageContext
receive()
Get a single message from the queue and deserialize for set into the message contextvoid
setAlive(boolean isAlive)
Set availability of connectivity with the message storevoid
setChannel(com.rabbitmq.client.Channel channel)
Set theChannel
objectvoid
setConnection(com.rabbitmq.client.Connection connection)
Set theConnection
objectvoid
setId(int id)
Set ID of this RabbitMQ consumervoid
setQueueName(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:
receive
in interfaceMessageConsumer
- Returns:
- the
MessageContext
with received message
-
ack
public boolean ack()
Acknowledge the message upon successful backend invocation- Specified by:
ack
in interfaceMessageConsumer
- Returns:
- whether message is successfully acknowledge or not
-
cleanup
public boolean cleanup()
Cleanup theConnection
and it's related resources- Specified by:
cleanup
in interfaceMessageConsumer
- Returns:
- whether cleanup successful or not
-
isAlive
public boolean isAlive()
Check availability of connectivity with the message store- Specified by:
isAlive
in interfaceMessageConsumer
- Returns:
true
if connection available,false
otherwise.
-
setAlive
public void setAlive(boolean isAlive)
Set availability of connectivity with the message store- Specified by:
setAlive
in interfaceMessageConsumer
- Parameters:
isAlive
- connection availability.
-
getId
public String getId()
Get ID of this RabbitMQ consumer- Specified by:
getId
in interfaceMessageConsumer
- Returns:
- the ID
-
setId
public void setId(int id)
Set ID of this RabbitMQ consumer- Specified by:
setId
in interfaceMessageConsumer
- Parameters:
id
- ID
-
setConnection
public void setConnection(com.rabbitmq.client.Connection connection)
Set theConnection
object- Parameters:
connection
- aConnection
object
-
setChannel
public void setChannel(com.rabbitmq.client.Channel channel)
Set theChannel
object- Parameters:
channel
- aChannel
object
-
setQueueName
public void setQueueName(String queueName)
Set the queue name- Parameters:
queueName
- the queue name
-
-