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
[EMAIL PROTECTED]

20/01/2008 19:44
Please respond to
[email protected]


To
users
cc

Subject
Re: error while handling a file send by poller






On Jan 20, 2008 11:09 AM, mmistroni <[EMAIL PROTECTED]> 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)[EMAIL PROTECTED]&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.

Reply via email to