There's also
Code:filename-generator-expression="headers['jms_messageId'].replace('<','').replace('>','') + '.bad'"
There's also
Code:filename-generator-expression="headers['jms_messageId'].replace('<','').replace('>','') + '.bad'"
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware
Hi Gary,
thanks for the provided example !
I'm checking the syntax because I got an error:
Thanks and regardsCode:Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 62 in XML document from file [C:\projects\maven\workspace\myListener\target\test-classes\myListener-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The value of attribute "filename-generator-expression" associated with an element type "null" must not contain the '<' character.
nuvola
Try '<' and '>' for '<' and '>'
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware
ciao Gary,
Your hint is perfect!
... I'm also trying to add a timestamp in the filename ...
The error is:Code:<file:outbound-channel-adapter id="unknownMessageTypeChannel" directory="file:${unknownMessageType.directory}" filename-generator-expression="'${myQueue.jndiName}' + '_' + headers['jms_messageId'].replace('<','').replace('>','').replace(':','_') + '_' + new SimpleDateFormat('ddMMyyyy_HHmmss').format(new Date()) + '.xml'"/>
I think it's wrong using ' instead of " within --> new SimpleDateFormat('ddMMyyyy...Code:Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1003E:(pos 104): A problem occurred whilst attempting to construct an object of type 'SimpleDateFormat' using arguments '(java.lang.String)'
I'm trying different tries ...
Thanks and regards
nuvola
You need to fully qualify 'java.text.SimpleDateFormat' and 'java.util.Date' so SpEL can find the classes.
Last edited by Gary Russell; Apr 26th, 2012 at 06:19 PM.
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware
Again thanks!
It works!
File generated: jms.MyQueue_ID_240478.1335483156383.0_27042012_013 254.xmlCode:<file:outbound-channel-adapter id="unknownMessageTypeChannel" directory="file:${unknownMessageType.directory}" filename-generator-expression="'${myQueue.jndiName}' + '_' + headers['jms_messageId'].replace('<','').replace('>','').replace(':','_') + '_' + new java.text.SimpleDateFormat('ddMMyyyy_HHmmss').format(new java.util.Date()) + '.xml'"/>
Ciao Gary,
I'm adding an errorChannel as in the log I see
I added in my applicationContext.xmlCode:27.apr.2012 13:54:26,255 - (MY LISTENER SERVICE) (main) [INFO ]-[DefaultConfiguringBeanFactoryPostProcessor(120 )] - No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
but the above INFO message is still there. I will open a new post on this specific topic for getting some best practices as it is not related directly with current thread on "xml:xpath-router"Code:<stream:stderr-channel-adapter channel="errorChannel" append-newline="true" />
Regards
nuvola
Just add
if you want to avoid that message; but it doesn't hurt anything.Code:<int:channel id="errorChannel"/>
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware