On Tue, Sep 1, 2009 at 6:48 AM, jamhit<[email protected]> 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

Reply via email to