Hi

Just to get the fact straight: You *must* use files, since there is an external 
app relying on this?

The key is to store the files in the correct order, so the external app can 
read the files in correct order as well. So the file name can express this 
order.

If for instance you can use just an incrementing number in the file then you 
are home free.

<from uri="jms:queue:A">
<to uri="file://somedir?expression=myemail-${bean:idgenerator}.txt"/>

<bean id="idgenerator" class=org.mycompany.MyIdGenerator"/>

Public class MyIdGenerator {
  Private static counter;

  Public int generateId() {
     Return counter++;
  }
}

You can also use timestamp for the filename

<from uri="jms:queue:A">
<to uri="file://somedir?expression=myemail-${date:now:yyyyMMddHHmmSSsss}.txt"/>

Where the date pattern is from java.text.SimpleDateFormat


Check out the File component and File Language:
http://activemq.apache.org/camel/file.html
http://activemq.apache.org/camel/file-language.html

File Language is new in Camel 1.5

If you are using Camel 1.4 then you must set the file name with the special 
header key: FileComponent.HEADER_FILE_NAME (org.apache.camel.file.name)

<from uri="jms:queue:A">
<setHeader headerName="org.apache.camel.file.name">
    <beanRef id="idgenerator"/>
</setHeader>
<to uri="file://somedir"/>

If you don't explict set a filename with the header Camel will use an 
autogenerated name, that can be used for testing.
PS: The spring setHeader syntax might need some tweak to get it correct with 
the bean expression.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: harpritt [mailto:[EMAIL PROTECTED] 
Sent: 20. oktober 2008 22:40
To: [email protected]
Subject: JMS to File to email to JMS


Hi

Appologies if i make noob comments, alas that is what i am.

Ive been tasked with conecting our remote locations with only email access
to our local jms queues.

I have one main requirement, the messages must arrive locally in the order
that they were added to the remote JMS queue.

this is what i think i can do 

JMS queue -> File Directory ---> picked up by an external email app and sent
to my local pop account --> Local JMS queue.

Do you guys see any problems with this? will camel know how to re-order the
messages in the local queue?
I really dont think it can unless i write some custom code.

ill be using the XML configuration because its a lot easier to document and
maintain.

Ive done lots of looking but cant seem to find the answer, but i have a
feeling that i will have to write my own file endpoint

as allways all help is appreciated.

Many Thanks


-- 
View this message in context: 
http://www.nabble.com/JMS-to-File-to-email-to-JMS-tp20078296s22882p20078296.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to