【问题标题】:ActiveMQ connection Url for Blob MessagesBlob 消息的 ActiveMQ 连接 URL
【发布时间】:2016-11-02 22:20:53
【问题描述】:

我的应用程序有一个远程 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();

【问题讨论】:

标签: java activemq


【解决方案1】:

网址应该是这样的embededbroker?jms.blobTransferPolicy.defaultUploadUrl=externalurl

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

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

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

【讨论】:

    猜你喜欢
    • 2015-08-22
    • 2021-03-06
    • 2018-07-05
    • 2012-10-18
    • 2013-11-01
    • 1970-01-01
    • 2016-03-27
    • 2018-02-03
    • 1970-01-01
    相关资源
    最近更新 更多