public class RabbitMQProducer extends java.lang.Object implements MessageProducer
Constructor and Description |
---|
RabbitMQProducer(RabbitMQStore store)
The RabbitMQ producer
|
Modifier and Type | Method and Description |
---|---|
boolean |
cleanup()
Used to close the channel opened in this object instance.
|
java.lang.String |
getId()
Get ID of this RabbitMQ producer
|
boolean |
isInitialized()
Verify to whether producer was initialized
|
void |
setChannel(com.rabbitmq.client.Channel channel)
Set the
Channel object |
void |
setConnection(com.rabbitmq.client.Connection connection)
Set the
Connection object |
void |
setExchangeName(java.lang.String exchangeName)
Set the exchange name to publish the message
|
void |
setId(int id)
Set ID of this RabbitMQ producer
|
void |
setPublisherConfirmsEnabled(boolean publisherConfirmsEnabled)
Set the publisher confirm enabled or not
|
void |
setRoutingKey(java.lang.String routingKey)
Set the routing key bind with the exchange
|
boolean |
storeMessage(MessageContext synCtx)
Store the given message into the queue and return whether the operation success or not
|
public RabbitMQProducer(RabbitMQStore store)
store
- the RabbitMQStore
objectpublic boolean storeMessage(MessageContext synCtx)
storeMessage
in interface MessageProducer
synCtx
- Message to be saved.true
if storing of the message is successful, false
otherwise.public boolean cleanup()
cleanup
in interface MessageProducer
true
if clean up is successful, false
otherwise.public java.lang.String getId()
getId
in interface MessageProducer
public void setId(int id)
setId
in interface MessageProducer
id
- IDpublic void setRoutingKey(java.lang.String routingKey)
routingKey
- the message routing keypublic void setExchangeName(java.lang.String exchangeName)
exchangeName
- the exchange to publish the message topublic void setConnection(com.rabbitmq.client.Connection connection)
Connection
objectconnection
- a Connection
objectpublic void setChannel(com.rabbitmq.client.Channel channel)
Channel
objectchannel
- a Channel
objectpublic void setPublisherConfirmsEnabled(boolean publisherConfirmsEnabled)
publisherConfirmsEnabled
- publsher confirm enabled or notpublic boolean isInitialized()
Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.