You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by mmistroni <mm...@gmail.com> on 2008/01/20 19:09:57 UTC

error while handling a file send by poller

hello all,
 i have followed good example for file move here

http://servicemix.apache.org/2-beginner-using-maven-to-develop-jbi-applications.html

it worked fine, but now i want to move forward by replacing the sender
endpoint with a serviceengine which process the file.....

i have written a simple serviceEngine following the HelloWorld SE, here's my
xbean.xml for the related su
[code]
<beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
	xmlns:ex="http://www.servicemix.org/example"> 

  <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/> 

</beans>
[/code]
My Endpoint implements ProviderEndpoint, and for the moment it does
nothing.. but the main method process() has some System.out prints that
shows me that the serviceengine has been invoked
[code]
protected void processInOut(MessageExchange exchange, NormalizedMessage in,
NormalizedMessage out) throws Exception {
		SourceTransformer sourceTransformer = new SourceTransformer();
		//String inMessage = sourceTransformer.toString(in.getContent());
		System.err.println("---- REceived Message from someone....");
		out.setContent(new StringSource("<hello>Hello World! Message</hello>."));
	}
[/code]

here's the xbean.xml for my tutorial-file-su (where i define the poller,
which will send a message to my SE containing the file, this is what i
assumed)

[code]
<beans xmlns:file="http://servicemix.apache.org/file/1.0"
       xmlns:tut="urn:servicemix:tutorial"
       xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
	xmlns:ex="http://www.servicemix.org/example">
	
  <!-- add the poller endpoint here -->    
  <file:poller service="tut:file" 
               endpoint="poller"
               file="file:///c:/servicemix-projects/in/" 
               targetService="ex:filehandler"
               targetEndpoint="handlerEndpoint">
               
               <property name="marshaler">
	             <bean
class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
    		</property>
   </file:poller>


</beans>
[/code]

But when my sa/se gets deployed, my SE does not get invoked....
what am i missing? am i missing some fundamental points here?

original example was using this as endpoint
[code]
<file:sender service="tut:file" 
               endpoint="sender"
             directory="file:///c:/servicemix-projects/out/" >
             <property name="marshaler">
	           <bean
class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
    	     </property>
  </file:sender>
  
  <file:poller service="tut:file" 
             endpoint="poller"
             file="file:/home/gert/poller" 
             targetService="tut:file"
             targetEndpoint="sender"/>

[/code]

i thought that all i needed was to replace  targetService/targetEndpoint
with info from my SE....

anyone could tell me what i am missing?

thanks and regards 
marco



-- 
View this message in context: http://www.nabble.com/error-while-handling-a-file-send-by-poller-tp14984633s12049p14984633.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: error while handling a file send by poller

Posted by Bruce Snyder <br...@gmail.com>.
On Jan 20, 2008 2:00 PM, mmistroni <mm...@gmail.com> wrote:
>
> Bruce,
>   thanks for replying me on a sunday :)

Sure :-).

> > bruce, what u described
> >>filesystem --> (file:poller) --> (custom SE)
> > is exactly what i am after. file poller i m sure it work (as it comes from
> > the samples where the poller send a filet o the sender, which writes it to
> > another dir
> > only thing i m puzzled is why request does not get routed to my custom SE
> > here's custom SE xbean.xml (file-handler-su)
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
> >       xmlns:ex="http://www.servicemix.org/example">
> >   <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/>
> > </beans>
> >
> > and here's xbean.xml for file-su (the one hwere i declare thepoller) (it
> > still contains file:sender though i dont use it.. mayb i should remove it
> > for clarity purposes)
> >
> > <beans xmlns:file="http://servicemix.apache.org/file/1.0"
> >
> >        xmlns:tut="urn:servicemix:tutorial"
> >
> >        xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
> >
> >       xmlns:ex="http://www.servicemix.org/example">
> >
> >
> >
> >   <!-- add the sender endpoint here -->
> >
> >   <file:sender service="tut:file"
> >
> >                endpoint="sender"
> >
> >              directory="file:///c:/servicemix-projects/out/" >
> >
> >              <property name="marshaler">
> >
> >                  <bean
> > class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
> >
> >            </property>
> >
> >   </file:sender>
> >
> >
> >
> >   <!-- add the poller endpoint here -->
> >
> >   <file:poller service="tut:file"
> >
> >                endpoint="poller"
> >
> >                file="file:///c:/servicemix-projects/in/"
> >
> >                targetService="ex:filehandler"
> >
> >                targetEndpoint="handlerEndpoint">
> >
> >
> >
> >                <property name="marshaler">
> >
> >                    <bean
> > class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
> >
> >               </property>
> >
> >    </file:poller>
> >
> >
> >
> >
> >
> > </beans>
> >
> >
> >
> > my endpoint extends ProviderEndpoint... i m somehow trying to mix sample
> > from helloworld-SE iwth the one from tutorial-file  ..

I don't see any incorrect or missing routing. At this point I usually
I advise the use of a servicemix-eip wiretap endpoint between the
file:poller and the custom SE so that you can log the message
somewhere to make sure it's coming out of the file:poller. Here's are
the docs on the wiretap:

http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-WireTap

I usually send the messages to a JMS queue so that I can see the
message queue count and easily browse the messages via Jconsole, but
you can send them wherever you prefer.

You're deploying both the custom SE installer.zip file and the SA
containing the configuration for it, correct?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Re: error while handling a file send by poller

Posted by mmistroni <mm...@gmail.com>.
Bruce,
  thanks for replying me on a sunday :)


bsnyder wrote:
> 
> 
>>If you're trying to pick up files from the filesystem and send
>>them to the custom SE, then the flow you want is as follows:
>>filesystem --> (file:poller) --> (custom SE)
>>The file:poller picks up files from the filesystem and sends them to
>>the custom SE.
>>I'm also not sure if your namespaces are matching as the namespace in
>>the custom SE must be the namespace used in the xbean.xml of any SU
>>routing to the custom SE. So I'd like to see the full xbean.xml files
>>with namespaces included.
> 
> bruce, what u described
>>filesystem --> (file:poller) --> (custom SE)
> is exactly what i am after. file poller i m sure it work (as it comes from
> the samples where the poller send a filet o the sender, which writes it to
> another dir
> only thing i m puzzled is why request does not get routed to my custom SE
> here's custom SE xbean.xml (file-handler-su)
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
> 	xmlns:ex="http://www.servicemix.org/example"> 
>   <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/> 
> </beans>
> 
> and here's xbean.xml for file-su (the one hwere i declare thepoller) (it
> still contains file:sender though i dont use it.. mayb i should remove it
> for clarity purposes)
> 
> <beans xmlns:file="http://servicemix.apache.org/file/1.0"
> 
>        xmlns:tut="urn:servicemix:tutorial"
> 
>        xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
> 
> 	xmlns:ex="http://www.servicemix.org/example">
> 
> 	
> 
>   <!-- add the sender endpoint here -->
> 
>   <file:sender service="tut:file" 
> 
>                endpoint="sender"
> 
>              directory="file:///c:/servicemix-projects/out/" >
> 
>              <property name="marshaler">
> 
> 	           <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
> 
>     	     </property>
> 
>   </file:sender>
> 
>   
> 
>   <!-- add the poller endpoint here -->    
> 
>   <file:poller service="tut:file" 
> 
>                endpoint="poller"
> 
>                file="file:///c:/servicemix-projects/in/" 
> 
>                targetService="ex:filehandler"
> 
>                targetEndpoint="handlerEndpoint">
> 
>                
> 
>                <property name="marshaler">
> 
> 	             <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
> 
>     		</property>
> 
>    </file:poller>
> 
> 
> 
> 
> 
> </beans>
> 
> 
> 
> my endpoint extends ProviderEndpoint... i m somehow trying to mix sample
> from helloworld-SE iwth the one from tutorial-file  ..
> 
> thanks and regards
>  marco
> 
> 
> 
> 
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
> Apache Geronimo - http://geronimo.apache.org/
> 
> Blog: http://bruceblog.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/error-while-handling-a-file-send-by-poller-tp14984633s12049p14986782.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: error while handling a file send by poller

Posted by ma...@uk.bnpparibas.com.
Bruce,
        my fault.. this msg was very old  i should have posted that i have 
fixed it (dont' remember having done that :(

everything is all right now..... i had a  poller-->custom SE working just 
fine....

thankx thought for your reply :)

regards
        marco



Internet
bruce.snyder@gmail.com

23/01/2008 18:57
Please respond to
users@servicemix.apache.org


To
users
cc

Subject
Re: error while handling a file send by poller






On Jan 23, 2008 10:32 AM,  <ma...@uk.bnpparibas.com> wrote:
> Bruce,
>  it's still me from my work address.....
>   have used wiretap. tried to use a poller and two senders, it worked 
like
> a charm
> when i substituted one of teh sender with my SE, i got following
> exception:
>
> ERROR - FileComponent                  - Failed to process file:
> c:\servicemix-p
> rojects\in\README2.txt. Reason: javax.jbi.messaging.MessagingException:
> Could no
> t find route for exchange: InOnly[
>   id: ID:10.102.130.33-117a79be1bc-7:183
>   status: Active
>   role: provider
>   service: {http://www.servicemix.org/example}filehandler
>   in: null
> ] for service: {http://www.servicemix.org/example}filehandler and
> interface: nul
> l
> javax.jbi.messaging.MessagingException: Could not find route for 
exchange:
> InOnl
> y[
>   id: ID:10.102.130.33-117a79be1bc-7:183
>   status: Active
>   role: provider
>   service: {http://www.servicemix.org/example}filehandler
>   in: null
> ] for service: {http://www.servicemix.org/example}filehandler and
> interface: nul

The error above is pretty standard. It means the NMR cannot locate the
service: {http://www.servicemix.org/example}filehandler. Have you used
Jconsole to look at SMX to see if all of your endpoints are deployed?
Check the list of endpoints that are deployed in SMX via Jconsole.

> **********************  SE xbean.xml ******************************
>
> <beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
>         xmlns:ex="http://www.servicemix.org/example">
>
>   <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/>
>
> </beans>

Do you have the above xbean.xml in it's on SU, wrapped in a SA and
deployed to SMX?

Bruce
-- 
perl -e 'print 
unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/



This communication is confidential, may be privileged and is meant only for the intended recipient.  If you are 
not the intended recipient, please notify the sender by reply and delete this message from your system.  Any 
unauthorised dissemination, distribution or copying hereof is prohibited.

BNP Paribas Fund Services UK Limited, BNP Paribas Trust Corporation UK Limited, BNP Paribas UK Limited, 
BNP Paribas Commodity Futures Ltd and Investment Fund Services Limited are authorised and regulated by 
the Financial Services Authority.

BNP Paribas, BNP Paribas Securities Services and BNP Paribas Private Bank are authorised by the CECEI 
and AMF.  BNP Paribas London Branch, BNP Paribas Securities Services London Branch and BNP Paribas 
Private Bank London Branch are regulated by the Financial Services Authority for the conduct of their UK 
business.  BNP Paribas Securities Services London Branch is also a member of the London Stock Exchange.


Re: error while handling a file send by poller

Posted by Bruce Snyder <br...@gmail.com>.
On Jan 23, 2008 10:32 AM,  <ma...@uk.bnpparibas.com> wrote:
> Bruce,
>  it's still me from my work address.....
>   have used wiretap. tried to use a poller and two senders, it worked like
> a charm
> when i substituted one of teh sender with my SE, i got following
> exception:
>
> ERROR - FileComponent                  - Failed to process file:
> c:\servicemix-p
> rojects\in\README2.txt. Reason: javax.jbi.messaging.MessagingException:
> Could no
> t find route for exchange: InOnly[
>   id: ID:10.102.130.33-117a79be1bc-7:183
>   status: Active
>   role: provider
>   service: {http://www.servicemix.org/example}filehandler
>   in: null
> ] for service: {http://www.servicemix.org/example}filehandler and
> interface: nul
> l
> javax.jbi.messaging.MessagingException: Could not find route for exchange:
> InOnl
> y[
>   id: ID:10.102.130.33-117a79be1bc-7:183
>   status: Active
>   role: provider
>   service: {http://www.servicemix.org/example}filehandler
>   in: null
> ] for service: {http://www.servicemix.org/example}filehandler and
> interface: nul

The error above is pretty standard. It means the NMR cannot locate the
service: {http://www.servicemix.org/example}filehandler. Have you used
Jconsole to look at SMX to see if all of your endpoints are deployed?
Check the list of endpoints that are deployed in SMX via Jconsole.

> **********************  SE xbean.xml ******************************
>
> <beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
>         xmlns:ex="http://www.servicemix.org/example">
>
>   <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/>
>
> </beans>

Do you have the above xbean.xml in it's on SU, wrapped in a SA and
deployed to SMX?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Re: error while handling a file send by poller

Posted by ma...@uk.bnpparibas.com.
Bruce,
 it's still me from my work address.....
  have used wiretap. tried to use a poller and two senders, it worked like 
a charm
when i substituted one of teh sender with my SE, i got following 
exception:

ERROR - FileComponent                  - Failed to process file: 
c:\servicemix-p
rojects\in\README2.txt. Reason: javax.jbi.messaging.MessagingException: 
Could no
t find route for exchange: InOnly[
  id: ID:10.102.130.33-117a79be1bc-7:183
  status: Active
  role: provider
  service: {http://www.servicemix.org/example}filehandler
  in: null
] for service: {http://www.servicemix.org/example}filehandler and 
interface: nul
l
javax.jbi.messaging.MessagingException: Could not find route for exchange: 
InOnl
y[
  id: ID:10.102.130.33-117a79be1bc-7:183
  status: Active
  role: provider
  service: {http://www.servicemix.org/example}filehandler
  in: null
] for service: {http://www.servicemix.org/example}filehandler and 
interface: nul
l


so, there's something wrong wtih my SE i guess (as when i was using 
wiretap with two different senders they were fine)

so, i'll post down the xbean.xml for the wiretap, xbean for my SE as well 
as code of my SE... i m sure i m doing something wrong in config
of my SE..

*********************** wiretap xbean xml 
***********************************
<beans xmlns:eip="http://servicemix.apache.org/eip/1.0"
       xmlns:tut="urn:servicemix:tutorial"
       xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
       xmlns:ex="http://www.servicemix.org/example">
 
 
  <eip:wire-tap service="tut:wiretap" endpoint="endpoint">
 
    <eip:target>
      <eip:exchange-target service="ex:filehandler" 
endpoint="handler:Endpoint"/>
    </eip:target>

    <eip:inListener>
      <eip:exchange-target service="tut:file" endpoint="sender" />
    </eip:inListener>
  </eip:wire-tap>

</beans>


**********************  SE xbean.xml ******************************

<beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
        xmlns:ex="http://www.servicemix.org/example"> 

  <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/> 

</beans>


*********************  SE Code ********************************
public class MyEndpoint extends ProviderEndpoint implements 
ExchangeProcessor {

    private ServiceEndpoint activated;
    private DeliveryChannel channel;
    private MessageExchangeFactory exchangeFactory;

    /* (non-Javadoc)
     * @see org.apache.servicemix.common.Endpoint#getRole()
     */
    public Role getRole() {
        return Role.PROVIDER;
    }

    public void activate() throws Exception {
        logger = this.serviceUnit.getComponent().getLogger();
        ComponentContext ctx = 
getServiceUnit().getComponent().getComponentContext();
        channel = ctx.getDeliveryChannel();
        exchangeFactory = channel.createExchangeFactory();
        activated = ctx.activateEndpoint(service, endpoint);
        start();
    }

    public void deactivate() throws Exception {
        stop();
        ServiceEndpoint ep = activated;
        activated = null;
        ComponentContext ctx = 
getServiceUnit().getComponent().getComponentContext();
        ctx.deactivateEndpoint(ep);
    }

    public ExchangeProcessor getProcessor() {
        return this;
    }

    public void validate() throws DeploymentException {
    }

    protected void send(MessageExchange me) throws MessagingException {
        if (me.getRole() == MessageExchange.Role.CONSUMER &&
            me.getStatus() == ExchangeStatus.ACTIVE) {
            BaseLifeCycle lf = (BaseLifeCycle) 
getServiceUnit().getComponent().getLifeCycle();
            lf.sendConsumerExchange(me, (Endpoint) this);
        } else {
            channel.send(me);
        }
    }

    protected void done(MessageExchange me) throws MessagingException {
        me.setStatus(ExchangeStatus.DONE);
        send(me);
    }

    protected void fail(MessageExchange me, Exception error) throws 
MessagingException {
        me.setError(error);
        send(me);
    }

    public void start() throws Exception {
    }

    public void stop() {
    }

    protected void processInOut(MessageExchange exchange, 
NormalizedMessage in, NormalizedMessage out) throws Exception {
                SourceTransformer sourceTransformer = new 
SourceTransformer();
                //String inMessage = 
sourceTransformer.toString(in.getContent());
                System.err.println("---- REceived Message from 
someone....");
                out.setContent(new StringSource("<hello>Hello World! 
Message</hello>."));
        }

}



anyone could help me out?

thanks and regards
 marco







Internet
bruce.snyder@gmail.com

20/01/2008 19:44
Please respond to
users@servicemix.apache.org


To
users
cc

Subject
Re: error while handling a file send by poller






On Jan 20, 2008 11:09 AM, mmistroni <mm...@gmail.com> wrote:
>
> hello all,
>  i have followed good example for file move here
>
> 
http://servicemix.apache.org/2-beginner-using-maven-to-develop-jbi-applications.html

>
> it worked fine, but now i want to move forward by replacing the sender
> endpoint with a serviceengine which process the file.....
>
> i have written a simple serviceEngine following the HelloWorld SE, 
here's my
> xbean.xml for the related su
> [code]
> <beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
>         xmlns:ex="http://www.servicemix.org/example">
>
>   <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/>
>
> </beans>
> [/code]
> My Endpoint implements ProviderEndpoint, and for the moment it does
> nothing.. but the main method process() has some System.out prints that
> shows me that the serviceengine has been invoked
> [code]
> protected void processInOut(MessageExchange exchange, NormalizedMessage 
in,
> NormalizedMessage out) throws Exception {
>                 SourceTransformer sourceTransformer = new 
SourceTransformer();
>                 //String inMessage = 
sourceTransformer.toString(in.getContent());
>                 System.err.println("---- REceived Message from 
someone....");
>                 out.setContent(new StringSource("<hello>Hello World! 
Message</hello>."));
>         }
> [/code]
>
> here's the xbean.xml for my tutorial-file-su (where i define the poller,
> which will send a message to my SE containing the file, this is what i
> assumed)
>
> [code]
> <beans xmlns:file="http://servicemix.apache.org/file/1.0"
>        xmlns:tut="urn:servicemix:tutorial"
>        xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
>         xmlns:ex="http://www.servicemix.org/example">
>
>   <!-- add the poller endpoint here -->
>   <file:poller service="tut:file"
>                endpoint="poller"
>                file="file:///c:/servicemix-projects/in/"
>                targetService="ex:filehandler"
>                targetEndpoint="handlerEndpoint">
>
>                <property name="marshaler">
>                      <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
>                 </property>
>    </file:poller>
>
>
> </beans>
> [/code]
>
> But when my sa/se gets deployed, my SE does not get invoked....
> what am i missing? am i missing some fundamental points here?
>
> original example was using this as endpoint
> [code]
> <file:sender service="tut:file"
>                endpoint="sender"
>              directory="file:///c:/servicemix-projects/out/" >
>              <property name="marshaler">
>                    <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
>              </property>
>   </file:sender>
>
>   <file:poller service="tut:file"
>              endpoint="poller"
>              file="file:/home/gert/poller"
>              targetService="tut:file"
>              targetEndpoint="sender"/>
>
> [/code]
>
> i thought that all i needed was to replace  targetService/targetEndpoint
> with info from my SE....

What I see above is that you changed a file:poller to a file:sender.
I'm not sure if that is what you've done but the descriptions above
are difficult to understand and it looks like this is what you've
done. If you're trying to pick up files from the filesystem and send
them to the custom SE, then the flow you want is as follows:

filesystem --> (file:poller) --> (custom SE)

The file:poller picks up files from the filesystem and sends them to
the custom SE.

I'm also not sure if your namespaces are matching as the namespace in
the custom SE must be the namespace used in the xbean.xml of any SU
routing to the custom SE. So I'd like to see the full xbean.xml files
with namespaces included.

Bruce
-- 
perl -e 'print 
unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/



This communication is confidential, may be privileged and is meant only for the intended recipient.  If you are 
not the intended recipient, please notify the sender by reply and delete this message from your system.  Any 
unauthorised dissemination, distribution or copying hereof is prohibited.

BNP Paribas Fund Services UK Limited, BNP Paribas Trust Corporation UK Limited, BNP Paribas UK Limited, 
BNP Paribas Commodity Futures Ltd and Investment Fund Services Limited are authorised and regulated by 
the Financial Services Authority.

BNP Paribas, BNP Paribas Securities Services and BNP Paribas Private Bank are authorised by the CECEI 
and AMF.  BNP Paribas London Branch, BNP Paribas Securities Services London Branch and BNP Paribas 
Private Bank London Branch are regulated by the Financial Services Authority for the conduct of their UK 
business.  BNP Paribas Securities Services London Branch is also a member of the London Stock Exchange.


Re: error while handling a file send by poller

Posted by Bruce Snyder <br...@gmail.com>.
On Jan 20, 2008 11:09 AM, mmistroni <mm...@gmail.com> wrote:
>
> hello all,
>  i have followed good example for file move here
>
> http://servicemix.apache.org/2-beginner-using-maven-to-develop-jbi-applications.html
>
> it worked fine, but now i want to move forward by replacing the sender
> endpoint with a serviceengine which process the file.....
>
> i have written a simple serviceEngine following the HelloWorld SE, here's my
> xbean.xml for the related su
> [code]
> <beans  xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
>         xmlns:ex="http://www.servicemix.org/example">
>
>   <hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/>
>
> </beans>
> [/code]
> My Endpoint implements ProviderEndpoint, and for the moment it does
> nothing.. but the main method process() has some System.out prints that
> shows me that the serviceengine has been invoked
> [code]
> protected void processInOut(MessageExchange exchange, NormalizedMessage in,
> NormalizedMessage out) throws Exception {
>                 SourceTransformer sourceTransformer = new SourceTransformer();
>                 //String inMessage = sourceTransformer.toString(in.getContent());
>                 System.err.println("---- REceived Message from someone....");
>                 out.setContent(new StringSource("<hello>Hello World! Message</hello>."));
>         }
> [/code]
>
> here's the xbean.xml for my tutorial-file-su (where i define the poller,
> which will send a message to my SE containing the file, this is what i
> assumed)
>
> [code]
> <beans xmlns:file="http://servicemix.apache.org/file/1.0"
>        xmlns:tut="urn:servicemix:tutorial"
>        xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
>         xmlns:ex="http://www.servicemix.org/example">
>
>   <!-- add the poller endpoint here -->
>   <file:poller service="tut:file"
>                endpoint="poller"
>                file="file:///c:/servicemix-projects/in/"
>                targetService="ex:filehandler"
>                targetEndpoint="handlerEndpoint">
>
>                <property name="marshaler">
>                      <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
>                 </property>
>    </file:poller>
>
>
> </beans>
> [/code]
>
> But when my sa/se gets deployed, my SE does not get invoked....
> what am i missing? am i missing some fundamental points here?
>
> original example was using this as endpoint
> [code]
> <file:sender service="tut:file"
>                endpoint="sender"
>              directory="file:///c:/servicemix-projects/out/" >
>              <property name="marshaler">
>                    <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
>              </property>
>   </file:sender>
>
>   <file:poller service="tut:file"
>              endpoint="poller"
>              file="file:/home/gert/poller"
>              targetService="tut:file"
>              targetEndpoint="sender"/>
>
> [/code]
>
> i thought that all i needed was to replace  targetService/targetEndpoint
> with info from my SE....

What I see above is that you changed a file:poller to a file:sender.
I'm not sure if that is what you've done but the descriptions above
are difficult to understand and it looks like this is what you've
done. If you're trying to pick up files from the filesystem and send
them to the custom SE, then the flow you want is as follows:

filesystem --> (file:poller) --> (custom SE)

The file:poller picks up files from the filesystem and sends them to
the custom SE.

I'm also not sure if your namespaces are matching as the namespace in
the custom SE must be the namespace used in the xbean.xml of any SU
routing to the custom SE. So I'd like to see the full xbean.xml files
with namespaces included.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/