of cource! I changed it....
see the attachment files..
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
        xmlns:sigsit="http://sigsit.org/siris/node/1.0";>
        <classpath>
                <location>.</location>
        </classpath>
        <sm:serviceunit id="jbi">               
                <sm:activationSpecs>

                        <!-- Write files to the outbox directory -->
                        <sm:activationSpec componentName="fileSender"
                                service="foo:fileSender">
                                <sm:component>
                                        <bean 
class="org.apache.servicemix.components.file.FileWriter">
                                                <property name="directory" 
value="outbox" />
                                                <property name="marshaler">
                                                        <bean
                                                                
class="org.apache.servicemix.components.util.BinaryFileMarshaler">
                                                        </bean>
                                                </property>
                                        </bean>
                                </sm:component>
                        </sm:activationSpec>

                        <!-- Look for files in the inbox directory -->
                        <sm:activationSpec componentName="filePoller"
                                destinationService="foo:fileProcessor" 
service="foo:filePoller">
                                <sm:component>
                                        <bean 
class="org.apache.servicemix.components.file.FilePoller">
                                                <property name="file" 
value="inbox" />
                                                <property name="period" 
value="1000" />
                                        <property name="marshaler">
                            <bean
class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
                        </property>
                                        </bean>
                                </sm:component>
                        </sm:activationSpec>                    
                        
                 
                
                <sm:activationSpec componentName="fileProcessor"
                                service="foo:fileProcessor">
                                <sm:component>
                                        <bean 
xmlns="http://xbean.org/schemas/spring/1.0";
                                                
class="org.apache.servicemix.components.jms.JmsSenderComponent">
                                                <property name="template">
                                                        <bean
                                                                
class="org.springframework.jms.core.JmsTemplate">
                                                                <property 
name="connectionFactory">
                                                                        <ref 
local="jmsFactory" />
                                                                </property>
                                                                <property 
name="defaultDestinationName"
                                                                        
value="demo.org.servicemix.source" />
                                                                <property 
name="pubSubDomain"
                                                                        
value="true" />
                                                        </bean>
                                                </property>
                                        </bean>
                                </sm:component>
                        </sm:activationSpec>
                                        
                        <sm:activationSpec componentName="fileReceiver"
                                service="foo:fileReceiver" 
destinationService="foo:fileSender">
                                <sm:component>
                                        <bean 
xmlns="http://xbean.org/schemas/spring/1.0";
                                                
class="org.apache.servicemix.components.jms.JmsInUsingJCABinding">
                                                <property name="jcaContainer" 
ref="jencks" />
                                                <property name="activationSpec">
                                                        <bean
                                                                
class="org.apache.activemq.ra.ActiveMQActivationSpec">
                                                                <property 
name="destination"
                                                                        
value="demo.org.servicemix.source" />
                                                                <property 
name="destinationType"
                                                                        
value="javax.jms.Topic" />
                                                        </bean>
                                                </property>
                                        </bean>
                                </sm:component>
                        </sm:activationSpec>            
                        

                         
        </sm:activationSpecs>                                                   
        
        
        </sm:serviceunit>


        <bean id="jndi"
                class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
                factory-method="makeInitialContext" singleton="true" />


        <!-- FACTORY BEAN -->
        <bean id="jmsFactory"
                class="org.apache.activemq.pool.PooledConnectionFactory">
                <property name="connectionFactory">
                        <bean
                                
class="org.apache.activemq.ActiveMQConnectionFactory">
                                <property name="brokerURL">
                                        <value>tcp://localhost:61616</value>
                                </property>
                        </bean>
                </property>
        </bean>

        <!-- the JCA container -->
        <bean id="jencks" class="org.jencks.JCAContainer" singleton="true">
                <!-- lets use the default configuration of work manager and 
transaction
manager-->
                <property name="bootstrapContext">
                        <bean
                                
class="org.jencks.factory.BootstrapContextFactoryBean">
                                <property name="threadPoolSize" value="25" />
                        </bean>
                </property>

                <!-- the JCA Resource Adapter -->
                <property name="resourceAdapter">
                        <bean id="activeMQResourceAdapter"
                                
class="org.apache.activemq.ra.ActiveMQResourceAdapter"
                                singleton="true">
                                <property name="serverUrl" 
value="tcp://localhost:61616" />
                        </bean>
                </property>
        </bean>
        
</beans>



nicola buso wrote:
> 
> Did you change the marshaller?
> The default try to read xml and put as payload, if you need to retrive a
> txt use the
> BinaryFileMarshaller that put the txt as an attachment.
> 
> take a look here:
> http://incubator.apache.org/servicemix/servicemix-file.html
> 
> Viali.Lee wrote:
>> I modified the file-binding example from the distribution, and tried to
>> transfer binary file(non-xml).
>> The filePoller component get the file from file system, then pass to the
>> fileProcessor compoent which will deliver the message to a
>> Queue(demo.org.servicemix.source). 
>> The fileReceiver component is always listening the
>> Queue(demo.org.servicemix.source), when message receiving, it passes the
>> message to fileSender compoent which will write the file to file system.
>> But it failed....How to solve this problem?
>> When I drop a file(a.txt) to inbox, error shows:
>> 
>>      [java] WARN  - SourceTransformer              - No Source available
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>>      [java] [Fatal Error] :-1:-1: Premature end of file.
>> http://www.nabble.com/file/p11779424/servicemix.xml servicemix.xml 
>> http://www.nabble.com/file/p11779424/activemq.xml activemq.xml 
> 
> -- 
> Nicola Buso
> Direzione Architetture e Consulenza
> Direzione Centrale Ricerca e Innovazione
> 
> 
> Engineering S.p.A.
> Padova, Italy
> Cso Stati Uniti, 23/I
> Tel. ++39 0498692513
> e-mail: [EMAIL PROTECTED]
> 
> 

-- 
View this message in context: 
http://www.nabble.com/file-binding-example-for-binary-file-through-jms...-tf4141085s12049.html#a11779846
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to