Sending Files using Active MQ with BlobMessage

我的梦境 提交于 2019-12-07 09:53:13

问题


I have an requirement in my application to send files from one application to another over HTTP/FTP protocol. I found following link which tells that the same can be done using Active MQ with supoort of Blob messages:

activemq.apache.org/blob-messages.html

I configured ActiveMq 5.8 on my windows machine, included required dependency for ActiveMQ lib in my pom.xml and i am able to send the simple javax.jms.TextMessage and javax.jms.MapMessage with org.springframework.jms.core.JmsTemplate

But while i moved to send BlobMessage using following method, a compile time error arises while creating the BlobMessage object from javax.jms.Session object which says

The method createBlobMessage(File) is undefined for the type Session

Here is the method i am using:

public void sendFile(){


        jmsTemplate.send(
        new MessageCreator() {
          public Message createMessage(Session session) throws JMSException {


              BlobMessage message = session.createBlobMessage(new File("/foo/bar"));
              return jmsTemplate.send(message);
          }
        }


);
}

Please help to resolve this compile time error.

Regards,

Arun


回答1:


The BlobMessage methods are not JMS spec methods so they won't appear in the javax.jms.Session interface, you need to cast to org.apache.activemq.ActiveMQSession in order to use the BlobMessage specific functionality.



来源:https://stackoverflow.com/questions/17550112/sending-files-using-active-mq-with-blobmessage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!