Hi,
I have declared a queue with following parametrs.
channel.exchangeDeclare(EXCHANGE_NAME, ExchangeType.DIRECT.getExchangeName(), true);
Map<String, Object> args = new HashMap<String, Object>();
args.put("x-queue-mode", "lazy");
channel.queueDeclare(QUEUE_NAME_1, false, true, false, args);
channel.queueBind(QUEUE_NAME_1, EXCHANGE_NAME, ROUTING_KEY_1);
While sending data :
channel.basicPublish(DirectExchange.EXCHANGE_NAME, DirectExchange.ROUTING_KEY_1, MessageProperties.PERSISTENT_TEXT_PLAIN, MESSAGE_1.getBytes());
Its properly storing in the local disk as well as its holding post server restart also.
But When I start my consumer its not consuming the data which is available inside the configure queue.
Following code I am using for the consumer:
Connection conn = RabbitMQConnection.getConnection();
if (conn != null)
{
Channel channel = conn.createChannel();
Consumer consumer1 = new DefaultConsumer(channel)
{
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException
{
String message = new String(body, "UTF-8");
System.out.println(" Message Received Queue 1 '" + message + "'");
}
};
channel.basicConsume(DirectExchange.QUEUE_NAME_1, false, consumer1);
Kindly help me on this to resolve this issue.
Thanks,
What I have tried:
I have tried with above consumer. But its not working.