Loading...

How to resolve Wire format negotiation timeout: peer did not send his wire format?


I would like to implement activeMQ in my project. I would like to start the broker in the Main but when I run it gives me this error : Wire format negotiation timeout: peer did not send his wire format.

I try to change the url path but it doesn't work

Main:

try
{
  BrokerService bs = mqManager.getBrokerService();
  System.out.println(bs.getBroker().getBrokerId());
  MessageProducer mp = mqManager.getMessageProducer(mqName);

  // scrittura del messaggio sulla coda
  TextMessage txtMsg = mqManager.getTextMessage("Finito");
  //System.out.println("Scrivo sulla coda " + mqName);
  mp.send(txtMsg);

}
catch (
    Exception e)
{
  // TODO Auto-generated catch block
  e.printStackTrace();
}

class Consumer

public static void main(String[] args) throws JMSException, 
  InterruptedException
  {
    String url = "vm://127.0.0.1:61618? 
    wireFormat.maxInactivityDurationInitalDelay=30000";
    if (args.length > 0)
    {
      url = args[0];
    }

    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);

    Destination destination = new ActiveMQQueue("LEO");

    Connection connection = connectionFactory.createConnection();
    connection.start();

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = session.createConsumer(destination);

    for (; ; )
    {
      System.out.println("Waiting for message.");
      Message message = consumer.receive();
      if (message == null)
      {
        break;
      }
      System.out.println("Got message: " + message);
    }

    connection.close();
  }

- - Source
comments powered by Disqus