Hi,

I just trim down the code, to let it send a file only. In this case, it
shows error pretty clear. Could you look at it for me ?

Here is the code of the RequestTool.java that send big file

//////////////////Start///////////////////////////

try {

    activeMQSession = (ActiveMQSession)session;
    blobMessage = activeMQSession.createBlobMessage(new
File("/tmp/testFile.exe"));
    producer.send(blobMessage);
    blobMessage.acknowledge();
    System.out.println("Sending message already");

    System.out.println("Waiting for reponse message...");


} catch (Exception e) {
  System.out.println("Error occur: " + e.getStackTrace());
}

////////////////End//////////////////////////////




Here is the code of the ConsumerTool.java that receive big file

//////////////////Start///////////////////////////

public void onMessage(Message message) {
    String temp1, temp2;
    byte[] fileData;
    File file;
    InputStream in;
    FileOutputStream fout;
    LinkedList dataList;
    String fileName;
    BlobMessage blobMessage;
    ActiveMQSession activeMQSession;
    int i;

    fileName = "";
    fileData = new byte[4096];

     try {

      if (message instanceof BlobMessage) {
        blobMessage = (BlobMessage) message;
        in = blobMessage.getInputStream();
        fout = new FileOutputStream("/tmp/0/testFile.exe");
        while((i = in.read(fileData)) != -1) {
          fout.write(fileData, 0, i);
        }
        fout.close();

      }

      System.out.println("Already sent file " +  fileName);


    } catch (Exception e) {
      System.out.println("Caught: " + e);
      e.printStackTrace();
    }

////////////////End//////////////////////////////



When I run the RequestTool and ConsumeTool, I receive errror
 

//////////////////Start errorMessage on RequestTool side//////////////

Connecting to URL: tcp://192.168.0.227:61616
Publishing a Message with size 1000 to queue: TEST.FOO
Using non-persistent messages
Sleeping between publish 1000 ms
Caught: javax.jms.JMSException: Wire format negotiation timeout: peer did
not send his wire format.
javax.jms.JMSException: Wire format negotiation timeout: peer did not send
his wire format.
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:58)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1215)
        at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1293)
        at
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:467)
        at RequesterTool.run(RequesterTool.java:96)
        at RequesterTool.main(RequesterTool.java:77)

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:88)
        at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:44)
        at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:67)
        at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:72)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1205)
        ... 4 more
       

/////////////////////////End////////////////////////////////////////////////



//////////////////Start errorMessage on ConsumeTool side//////////////

Connecting to URL: tcp://192.168.0.227:61616
Consuming queue: TEST.FOO
Using a non-durable subscription
Caught: javax.jms.JMSException: Wire format negotiation timeout: peer did
not send his wire format.
javax.jms.JMSException: Wire format negotiation timeout: peer did not send
his wire format.
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:58)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1215)
        at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1293)
        at
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:467)
        at ConsumerTool.run(ConsumerTool.java:98)
        at ConsumerTool.main(ConsumerTool.java:81)
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:88)
        at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:44)
        at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:67)
        at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:72)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1205)
        ... 4 more

/////////////////////////End////////////////////////////////////////////////


I have the feeling the main issue is -- Caught: javax.jms.JMSException: Wire
format negotiation timeout: peer did not send his wire format.

Can you show me some example how to use ActiveMQBlobMessage ?

I appreciate you for spending time help me out.

Thanks,

Tom










-- 
View this message in context: 
http://www.nabble.com/How-to-send-file-using-ActiveMQ-tf3960326s2354.html#a11292303
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to