0

I am trying to send a message to the Qpid broker over the AMQP 1.0 protocol. The queue is named queue2 and it is already created under default virtualhost. However, producer.send(message) is getting stuck forever. The same code is working for connecting to Azure Service Bus. I'm using qpid-jms-client 0.58. Producer code is:

Hashtable<String, String> hashtable = new Hashtable<>();
hashtable.put("connectionfactory.myFactoryLookup", protocol + "://" + url + "?amqp.idleTimeout=120000&amqp.traceFrames=true");
hashtable.put("queue.myQueueLookup", queueName);
hashtable.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jms.jndi.JmsInitialContextFactory");

Context context = new InitialContext(hashtable);

ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
queue = (Destination) context.lookup("myQueueLookup");

Connection connection = factory.createConnection(username, password);
connection.setExceptionListener(new AmqpConnectionFactory.MyExceptionListener());

connection.start();

Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

// session.createQueue("queue3");
Queue queue = new JmsQueue("queue2");
MessageProducer messageProducer = session.createProducer(queue);
TextMessage textMessage = session.createTextMessage("new message");
messageProducer.send(textMessage) 

I can see Connection and session is successfully established on Qpid broker dashboard: Qpid Broker dashboard

Thread dump for application at time of producing

java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x000000078327c550> (a org.apache.qpid.jms.provider.ProgressiveProviderFuture)
    at java.lang.Object.wait(Object.java:502)
    at org.apache.qpid.jms.provider.ProgressiveProviderFuture.sync(ProgressiveProviderFuture.java:154)
    - locked <0x000000078327c550> (a org.apache.qpid.jms.provider.ProgressiveProviderFuture)
    at org.apache.qpid.jms.JmsConnection.send(JmsConnection.java:773)
    at org.apache.qpid.jms.JmsNoTxTransactionContext.send(JmsNoTxTransactionContext.java:37)
    at org.apache.qpid.jms.JmsSession.send(JmsSession.java:964)
    at org.apache.qpid.jms.JmsSession.send(JmsSession.java:843)
    at org.apache.qpid.jms.JmsMessageProducer.sendMessage(JmsMessageProducer.java:252)
    at org.apache.qpid.jms.JmsMessageProducer.send(JmsMessageProducer.java:182)

I have tried to run this example which gave the same result.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • @JustinBertram I think the problem may be how I have configured Qpid broker J. As with service bus same code works fine. I have tried to run https://github.com/apache/qpid-jms/tree/0.58.0/qpid-jms-examples , which also put me on same situation. Update thread dump for application on question. I don't see any log on thread dump on qpid broker J at time of ``` producer.send``` – Ankur Mukherjee Sep 11 '21 at 16:53

2 Answers2

1

In general if the client is not sending it is because the remote has not granted it credit to do so. You can debug the client state using the protocol trace feature (just set PN_TRACE_FRM=true and run the client).

Likely you have misconfigured the Broker-J somehow and the destination you've created doesn't allow any messages to be sent or you've sent enough that you've tripped the write limit. You should consult the configuration guide and review what you've already setup.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
0

Okay Finally got the issue. Filesystem is over 90 per cent full, enforcing flow control. So deleted files from my machine and it started working. https://qpid.apache.org/releases/qpid-broker-j-7.0.7/book/Java-Broker-Runtime-Disk-Space-Management.html