I want to go the the destinatiion where the orginal (exchange)
messageExchange was pointing. I want to get the target Qname from the
exchange object itseltf. My route actually defined in the EIP Component. SO
can I specify somethig like. In my eip component I am going to ftp
lwComponent from this bean. But I don't want to hard cord that destination
here.  I want to get that destination from the messageExchange or channel
itself.

exchangeRobustInOnly.setService(exchange.getService());

here is the the method implementaion

        public void onMessageExchange(MessageExchange exchange)
                        throws MessagingException {
                if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                        NormalizedMessage message = exchange.getMessage("in");
                        Source content = message.getContent();
                        NormalizedMessage outMessage = exchange.createMessage();
                        outMessage.setContent(content);
                        /*
                         * Transform the incomeing xml message in to the text 
content
                         */
                        InputStream inputStream = null;
                        try {
                                inputStream = new ClassPathResource(XSLT_SOURCE)
                                                .getInputStream();

                        } catch (IOException e) {
                                log.error("Could not initilize the xsl stream 
");
                                throw new MessagingException(
                                                "Could not initilize the xsl 
stream ");
                        }
                        ByteArrayOutputStream out = 
XMLTransformer.getInstance().transform(
                                        content, inputStream);
                        MessageExchangeFactory factory = 
channel.createExchangeFactory();
                        RobustInOnly exchangeRobustInOnly = factory
                                        .createRobustInOnlyExchange();
                        DataSource ds = new 
ByteArrayDataSource(out.toByteArray(), null);
                        DataHandler handler = new DataHandler(ds);
                        outMessage.addAttachment("content", handler);
                        String fileName = "lms_Funds_" + 
System.currentTimeMillis()
                                        + ".txt";
                        outMessage.setProperty(FILE_NAME_PROPERTY, fileName);
                        exchangeRobustInOnly.setInMessage(outMessage);
                        channel.send(exchangeRobustInOnly);

                }
        }




gnodet wrote:
> 
> It's not about copying anything, but specifying where your exchange will
> go.
> Where do you want it to go ?
> 
> On Wed, Sep 17, 2008 at 7:17 PM, NeenaMathew
> <[EMAIL PROTECTED]> wrote:
>>
>> Thank you for the quick response. I don't want to get the qname and other
>> values from the MessageExchange that is passed to my method. I thought
>> the
>> messageExhange factory copies all these values when it creates the
>> MessageExhange.
>>
>> How can I get the target Qname from the input messageExhange?
>>
>>
>>
>> gnodet wrote:
>>>
>>> You need to specify where you want to send your exchange.
>>> This is usually done using;
>>>   exchangeRobustInOnly.setService( qname );
>>> but depending how you want to target the endpoint, you can also use
>>> setInterface() or setEndpoint().
>>>
>>> Btw, you don't have to set the status of the exchange to active.
>>>
>>> On Tue, Sep 16, 2008 at 8:12 PM, NeenaMathew
>>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Hi
>>>>
>>>> I have webservice reciveing some soap request doing some validation and
>>>> enrichment, then need to create a text file from the data and Secure
>>>> ftp
>>>> the
>>>> file to another system and send the response back to the client.
>>>>
>>>> Here is my Route
>>>>
>>>> cxfBC - cxfSE- ServiceMix-Bean(does translation to text file and attach
>>>> the
>>>> file in message)- FTP-ServiceMix-Bean(Generate the Response back to
>>>> Client
>>>> with proper message codes)
>>>>
>>>> In my translation component I am trying to create a RobustInOnly
>>>> Exchange
>>>> for my FTP component.
>>>> I am not sure this is the pattern I need to follow. but just trying
>>>> out...
>>>>
>>>> I use something like this
>>>>
>>>> MessageExchangeFactory factory = channel.createExchangeFactory();
>>>> RobustInOnly exchangeRobustInOnly =
>>>> factory.createRobustInOnlyExchange();
>>>> exchangeRobustInOnly.setInMessage(outMessage);
>>>> exchangeRobustInOnly.setStatus(ExchangeStatus.ACTIVE);
>>>> channel.send(exchangeRobustInOnly);
>>>>
>>>> When I deploy I am getting the following error.
>>>>
>>>> I ran servicemix in debug mode and found that when the RobustInOnly
>>>> exchange
>>>> is created the code is trying to copy the endpoint and servicename from
>>>> messageFactoryimpl class. but the values are null in factory object
>>>>
>>>> INFO: Interceptor has thrown exception, unwinding now
>>>> org.apache.cxf.interceptor.Fault: Could not find route for exchange:
>>>> RobustInOnly[
>>>>  id: ID:172.24.44.33-11c6c115be6-4:6
>>>>  status: Active
>>>>  role: provider
>>>>  in: <?xml version="1.0" encoding="UTF-8"?><jbi:message
>>>> xmlns:jbi="http://java.sun.com/xml/ns/jbi/w...
>>>> ] for service: null and interface: null
>>>>        at
>>>> org.apache.servicemix.cxfbc.CxfBcConsumer$JbiPostInvokerInterceptor.handleMessage(CxfBcCo
>>>> nsumer.java:560)
>>>>        at
>>>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>>>>        at
>>>> org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:198)
>>>>        at
>>>> org.apache.servicemix.cxfbc.CxfBcConsumer.process(CxfBcConsumer.java:203)
>>>>        at
>>>> org.apache.servicemix.cxfbc.CxfBcConsumer$JbiInvokerInterceptor.handleMessage(CxfBcConsum
>>>> er.java:536)
>>>>        at
>>>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>>>>        at
>>>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:7
>>>> 7)
>>>>        at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestinat
>>>> ion.java:278)
>>>>        at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.j
>>>> ava:252)
>>>>        at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
>>>>        at
>>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
>>>>        at
>>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:2
>>>> 06)
>>>>        at
>>>> org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
>>>>        at
>>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>>        at org.mortbay.jetty.Server.handle(Server.java:324)
>>>>        at
>>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>>>        at
>>>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
>>>>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
>>>>        at
>>>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>>>        at
>>>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>>>        at
>>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>>>        at
>>>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
>>>> Caused by: javax.jbi.messaging.MessagingException: Could not find route
>>>> for
>>>> exchange: RobustInOnly[
>>>>  id: ID:172.24.44.33-11c6c115be6-4:6
>>>>  status: Active
>>>>  role: provider
>>>>  in: <?xml version="1.0" encoding="UTF-8"?><jbi:message
>>>> xmlns:jbi="http://java.sun.com/xml/ns/jbi/w...
>>>> ] for service: null and interface: null
>>>>        at
>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>>        at
>>>> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:88
>>>> )
>>>>        at
>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>>        at
>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:3
>>>> 95)
>>>>        at
>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:431
>>>> )
>>>>        at
>>>> org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:79
>>>> )
>>>>        at
>>>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:578)
>>>>        at
>>>> com.freddiemac.services.treasury.funds.SaxonBean.onMessageExchange(SaxonBean.java:88)
>>>>        at
>>>> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:240)
>>>>        at
>>>> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:216)
>>>>        at
>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:540)
>>>>        at
>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:4
>>>> 92)
>>>>        at
>>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>>>>        at
>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImp
>>>> l.java:610)
>>>>        at
>>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
>>>>        at
>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>>>>        at
>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>>>        at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>>        at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>>        at java.lang.Thread.run(Thread.java:595)
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/creating-RobustInOnly-messageExchange-tp19517513p19517513.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/creating-RobustInOnly-messageExchange-tp19517513p19537032.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/creating-RobustInOnly-messageExchange-tp19517513p19537539.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to