Avatar of narcist527
narcist527
 asked on

jms activemq ;sending message to the already existing remote queue

I am trying to send a message to already existing queue and using the below code and not working. I found this on internet and playing around this. here he is creating queue . But I want to send a message without creating queue. it was throwing an error " javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format."

any help is highly appreciated

QueueConnectionFactory connectionFactory=new ActiveMQConnectionFactory("vm://test");
  QueueConnection queueConnection=null;
  QueueSession session=null;
  QueueSender sender=null;
  Queue queue=null;
  TextMessage message=null;
  try {
    queueConnection=connectionFactory.createQueueConnection();
    session=queueConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
    queue=session.createQueue(TEST_QUEUE_NAME);
    sender=session.createSender(queue);
    sender.setDeliveryMode(DeliveryMode.PERSISTENT);
    message=session.createTextMessage(String.valueOf(i));
    sender.send(message);
JavaJava EE

Avatar of undefined
Last Comment
mccarl

8/22/2022 - Mon
mccarl

Can you send the full code that you used? This is so we can run it and check for ourselves.

Can you tell us what version of ActiveMQ you are using?

Can you post the full exception message AND stack trace that you get?
narcist527

ASKER
@mccarl,
first off thanks for reply.

as a automation testing engineer, I am working on automating this process. so I was provided with jndi url, connection factory string , queues and topics. I have been trying to send the message to already existing queues. These are remote queues. I replaced the parameters in that code snippet with the appropriate values and it is throwing the below error. appreciate your time and help

javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format.
      at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
      at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1206)
      at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1289)
      at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:295)
      at org.apache.activemq.ActiveMQConnection.createQueueSession(ActiveMQConnection.java:1143)
      at com.swa.jmsmessages.SendingJmsMsg.main(SendingJmsMsg.java:82)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.io.IOException: Wire format negotiation timeout: peer did not send his wire format.
      at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:94)
      at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
      at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:74)
      at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:79)
      at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1195)
      ... 9 more
ASKER CERTIFIED SOLUTION
mccarl

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck