繁体   English   中英

Blob消息的ActiveMQ连接网址

[英]ActiveMQ connection Url for Blob Messages

我的应用程序中有一个远程ActiveMQ服务器和嵌入式ActiveMQ服务器。 当我发送短信时,它正在工作。 但是,当我尝试发送Blob消息时,它将引发java.net.MalformedURLExceptionjava.lang.NumberFormatException引起的javax.jms.JMSException

我的经纪人网址

String broker1 = "tcp://localhost:7005?jms.blobTransferPolicy.defaultUploadUrl=http://localhost:61617";

其中tcp://localhost:7005是嵌入式代理,而http://localhost:61617是远程代理。

我的生产者代码

File file=new File("C:/Users/xxx/Downloads/1234.txt");

ActiveMQConnection connection = ActiveMQConnection.makeConnection(broker);
connection.start();
ActiveMQSession session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Create the destination (Topic or Queue)
Destination destination = session.createQueue("test");
MessageProducer producer = session.createProducer(destination);

BlobMessage message = session.createBlobMessage(file);
System.out.println("upload started");
producer.send(message);
System.out.println("upload finished");
session.close();
connection.close();

URL应该像这样embededbroker?jms.blobTransferPolicy.defaultUploadUrl=externalurl

如果嵌入式URL失败,那么将使用外部URL。默认情况下,activemq在此链接中提供文件服务器http://(activemq server ip):portnumber/fileserver

例如,如果您在localhost url上运行的activemq服务器应为http://localhost:8161/fileserver/

它支持HTTP或FTP或SCP或其他一些点对点协议。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM