简体   繁体   English

Blob消息的ActiveMQ连接网址

[英]ActiveMQ connection Url for Blob Messages

I my application i have a remote ActiveMQ server and embedded ActiveMQ Server. 我的应用程序中有一个远程ActiveMQ服务器和嵌入式ActiveMQ服务器。 When i send text messages it's working. 当我发送短信时,它正在工作。 But when i try to send Blob messages it throws a javax.jms.JMSException caused by java.net.MalformedURLException and java.lang.NumberFormatException . 但是,当我尝试发送Blob消息时,它将引发java.net.MalformedURLExceptionjava.lang.NumberFormatException引起的javax.jms.JMSException

My Broker URL 我的经纪人网址

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

where tcp://localhost:7005 is an embedded broker, and http://localhost:61617 is a remote broker. 其中tcp://localhost:7005是嵌入式代理,而http://localhost:61617是远程代理。

My Producer code 我的生产者代码

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 should be like this embededbroker?jms.blobTransferPolicy.defaultUploadUrl=externalurl URL应该像这样embededbroker?jms.blobTransferPolicy.defaultUploadUrl=externalurl

In case of failure in embedded URL then external URL will be used.By default activemq provides a file server in this link http://(activemq server ip):portnumber/fileserver 如果嵌入式URL失败,那么将使用外部URL。默认情况下,activemq在此链接中提供文件服务器http://(activemq server ip):portnumber/fileserver

For example if your activemq server running on localhost url should be http://localhost:8161/fileserver/ It 例如,如果您在localhost url上运行的activemq服务器应为http://localhost:8161/fileserver/

It supports HTTP or FTP or SCP or some other point-to-point protocol. 它支持HTTP或FTP或SCP或其他一些点对点协议。

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

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