camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamhit <Hitha.A...@sabre-holdings.com>
Subject Re: camel mina using beanRef
Date Tue, 01 Sep 2009 05:53:54 GMT

Thank you very much Claus! That helped. Even though bean expression does not
seem to be recognized by reciepientList in camel 1.6 DSL, I could make it
work  using header expression and have my pojo set the header.

Thanks again. Appreciate your help.


Claus Ibsen-2 wrote:
> 
> On Tue, Sep 1, 2009 at 6:48 AM, jamhit<Hitha.Alex@sabre-holdings.com>
> wrote:
>>
>> I am a camel newbie trying to use mina tcp to talk to a legacy system and
>> get
>> response back. Since the host:port for the legacy system to talk varies
>> with
>> each exchange,  I am using a beanRef with mina url and appropriate codec.
>> I
>> can see that the response is properly decoded and written to
>> protocoldecoderoutput by my response decoder. But, my exchange out
>> message
>> is still the tcp url returned by the beanRef. I am sure, I am missing
>> something missing to actually see the decoded response in my exchange. I
>> have been struggling with it for more than a week and any suggestions
>> would
>> be greatly appreciated. My route is something like this
>>
>> from(direct:someEndpoint).marshal().string("UTF-8").beanRef("MinaUrlFinder",
>> "route").
>>                .process(new Processor() {
>>                public void process(Exchange exchange) {
>>                    Message out = exchange.getOut();
>>                    System.out.println("Response " +
>> out.getBody(String.class));
>>            }
>>        });
>>
>> What I see as output here is the Mina URL returned by the beanRef. What I
>> really want to see is the actual response coming from the external server
>> over tcp.
>>
> 
> Use the .recipientList in the DSL instead of .beanRef.
> And since recipientList accepts an Expression as parameter we can use
> the method call expression (which has the name bean)
> 
> from(direct:someEndpoint).marshal().string("UTF-8").receipientList(bean("MinaUrlFinder",
> "route"));
> 
> And then you can loose the @RecipientList annotation
> 
> 
>> My beanRef route method is like this:
>>
>>    @RecipientList
>>    public String route(@Body Document body, Exchange exchange) throws
>> Exception {
>>
>>        String mina_uri = getMinaUriForServiceId(serviceId);
>>        if (mina_uri.isEmpty()) {
>>            throw new Exception();
>>        }
>>        return mina_uri;
>>    }
>> --
>> View this message in context:
>> http://www.nabble.com/camel-mina-using-beanRef-tp25234264p25234264.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 
=)
-- 
View this message in context: http://www.nabble.com/camel-mina-using-beanRef-tp25234264p25234709.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message