You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jussi Nummelin <ju...@gmail.com> on 2010/01/15 16:15:19 UTC
File sender, DefaultMarshaler
Hi,
I'm trying to setup a file-sender endpoint where I'd like to change
the file name based on the message content.
In the SVN, there is a test case where the marshaler is configured like this:
<bean class="org.apache.servicemix.components.util.DefaultFileMarshaler"
id="defaultFileMarshaler">
<property name="fileName"><value>concat($name, '.xml')</value></property>
</bean>
What happens in my environment is that I get the file name like this:
(No matter what I put as the xpath)
concat($name, '.xml')
So instead of using xpath, it just takes file name as specified in the property.
So the question is, how to properly define the xpath for the default
marshaler. I know it should be possible since I remeber using it a
while ago with some older version of SMX. :)
Btw, I'm using 3.3.1 version and the file component version is 2009.01
Cheers,
- Jussi -
Re: File sender, DefaultMarshaler
Posted by Jussi Nummelin <ju...@gmail.com>.
With some googling I found the solution. Defined the marshaler like this:
<file:marshaler>
<bean class="org.apache.servicemix.components.util.DefaultFileMarshaler">
<property name="fileName">
<bean
class="org.apache.servicemix.expression.JAXPStringXPathExpression">
<constructor-arg value="concat('filePrefix-', /someElement, '.xml')" />
</bean>
</property>
</bean>
</file:marshaler>
Works like a charm. :)
Cheers,
- Jussi -
On Fri, Jan 15, 2010 at 5:15 PM, Jussi Nummelin
<ju...@gmail.com> wrote:
> Hi,
>
> I'm trying to setup a file-sender endpoint where I'd like to change
> the file name based on the message content.
>
> In the SVN, there is a test case where the marshaler is configured like this:
> <bean class="org.apache.servicemix.components.util.DefaultFileMarshaler"
> id="defaultFileMarshaler">
> <property name="fileName"><value>concat($name, '.xml')</value></property>
> </bean>
>
>
> What happens in my environment is that I get the file name like this:
> (No matter what I put as the xpath)
> concat($name, '.xml')
>
> So instead of using xpath, it just takes file name as specified in the property.
>
> So the question is, how to properly define the xpath for the default
> marshaler. I know it should be possible since I remeber using it a
> while ago with some older version of SMX. :)
>
> Btw, I'm using 3.3.1 version and the file component version is 2009.01
>
>
> Cheers,
> - Jussi -
>