camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From watcher <patr...@daly.ws>
Subject Re: Large file processing
Date Wed, 07 May 2008 13:59:15 GMT

I've made some progress since my last post but I'm still having a few issues.

I now have an example of sending a file to a queue using the BlobMessage
feature of ActiveMQ. The file is persisted on a jetty fileserver thats
shipped with ActiveMq. 
I have two questions.
1. How to I send a blobmessage using camelTemplate? 
2. How can I persist the file on the fileserver with the original filename
rather the messageId generated by  JMS?

Here's the code, 

Client.java

getJmsTemplate().send(new MessageCreator() {
	public Message createMessage(Session session) throws JMSException {
	             	BlobMessage message = null;
	                try{
			     InputStream inputStream = new FileInputStream(new
File("c:\\log.log"));
			     message = ((ActiveMQSession)session).createBlobMessage(inputStream);		           
      		      
		         }catch(Exception e ){
		                		e.printStackTrace();
		         }
		          return message;
         }
});


applicationContext.xml 

 <bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property
name="brokerURL"value="tcp://localhost:61616?jms.blobTransferPolicy.uploadUrl=http://localhost:8161/fileserver/repos/&amp;jms.copyMessageOnSend=false"
/> 
</bean>
		 
<bean id="fileDestination"
class="org.apache.activemq.command.ActiveMQQueue">
		  <constructor-arg index="0" value="files" /> 
</bean>

Thanks
Paddy

-- 
View this message in context: http://www.nabble.com/Large-file-processing-tp16993253s22882p17105622.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message