Blob消息的ActiveMQ连接Url



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

我的Broker URL

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

例如,如果你的activemq服务器运行在本地主机url应该是http://localhost:8161/fileserver/

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

最新更新