ActiveMQ/Camel send file for further processing
By : Tom G
Date : March 29 2020, 07:55 AM
will help you Camel's content based router is what you are looking for. It allows you to setup routing rules based on the message body/headers/properties... Here is a basic example that reads from an inbound queue and simply delegates to other queues based on headers... code :
from("activemq:queue:inboundQueue")
.choice()
.when(header("foo").isEqualTo("bar"))
.to("activemq:queue:barQueue")
.when(header("foo").isEqualTo("cheese"))
.to("activemq:queue:cheeseQueue")
.otherwise()
.to("activemq:queue:generalQueue");
|
yum install activemq activemq-client - no package activemq available
By : nikos mitsis
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , For a simple installation following the tutorial you have to enable different repos for yum, this can be done by code :
subscription-manager repos --enable=*repoid*
subscription-manager repos --list
|
Unable to send local file to activeMQ
By : hemadri_ kanaparthi
Date : March 29 2020, 07:55 AM
hop of those help? Yes when using blob you need to use an out of band transport, see more details at: http://activemq.apache.org/blob-messages.htmlThen you need to setup that chosen such as ftp,http etc and add the dependencies to the client classpath.
|
How to send a file to the ActiveMQ Queue?
By : CHINNU B.R
Date : March 29 2020, 07:55 AM
To fix this issue @Mary Zheng provided an excellent example, how it may be done: ActiveMQ File Transfer Example code :
private void sendFileAsBytesMessage(File file) throws JMSException, IOException {
BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.setStringProperty("fileName", file.getName());
bytesMessage.writeBytes(fileManager.readfileAsBytes(file));
msgProducer.send(bytesMessage);
}
ConnectionFactory connFactory =
new ActiveMQConnectionFactory(username, password, activeMqBrokerUri);
Connection connection = connFactory.createConnection();
ActiveMQSession session =
(ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
public class FileAsByteArrayManager {
public byte[] readfileAsBytes(File file) throws IOException {
try (RandomAccessFile accessFile = new RandomAccessFile(file, "r")) {
byte[] bytes = new byte[(int) accessFile.length()];
accessFile.readFully(bytes);
return bytes;
}
}
public void writeFile(byte[] bytes, String fileName) throws IOException {
File file = new File(fileName);
try (RandomAccessFile accessFile = new RandomAccessFile(file, "rw")) {
accessFile.write(bytes);
}
}
}
|
ActiveMQ send and receive folder of XML file
By : Afia Khan
Date : March 29 2020, 07:55 AM
I wish did fix the issue. ActiveMQ is not a storage facility, it is a message-passing facility. That being said you should look at Camel, Mule or Spring Integration, all of which can use ActiveMQ for messaging. They all have support for polling folders for files to send as messages and depositing messages into folders.
|