You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dkozic <dr...@asw.eu> on 2008/08/22 13:50:34 UTC

mina tcp client problem

Hi,

I would like to make route that will send text line to remote tcp host:port,
read response and proceed with that response in body further in route. I
have already make something similar with 

I tried with following route:

from("timer://whcTimer?period=20000&delay=10000")
.setBody(constant("0001134765 C 65405818"))
.processRef("systemOutProcessor").processRef("debugProcessor")
.to("seda:whcLog")
.to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
.processRef("systemOutProcessor")
.processRef("debugProcessor").to("seda:whcLog");

from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");

The log output is:

2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] WRITE: 0001134765 C 65405818
Entered SystemOutProcessor.
2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] SENT: 0001134765 C 65405818
2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
Subscriber record was not created: subscriber already exists

>From the log you can see that mina does tcp send and receive data. But,
after mina the in message body is same as before. 

How to access response from remote server?
As I said, I expected behavior like in http component. I have tried with
sync = "true" with no success.

Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP SP1

Thanks in advance
-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Sorry I am using a shite mail client so reply is here in top.

Camel has many solutions. So I pick the one I can think of right now.

The "mina stuff in the route" should be replaced with a processor. In the processor you can do manual java code and manually invoke the mina component and get the response. And then set the response on the original exchange object.

Public void process(Exchange exchange) {
   ProducerTemplate template = Exchange.getCamelContext().createProducerTemplate();

   String body = exchange.getIn().getBody(String.class);
   Object response = template.sendBody("mina:tcp://remoteserver:port?sync=true&textline=true");

   // set new input on original exchange with the mina response
   exchange.getIn().setBody(response);
}




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 26. august 2008 11:04
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


Hi there,


Claus Ibsen wrote:
> 
> As a workaround you must manually "remember" the headers and set them
> after the mina stuff.
> 
Can you elaborate a little bit more or provide example?

Thanks in advance


Claus Ibsen wrote:
> 
> Could you add a ticket for the "camel-mina should preserve headers"
> feature. Then we can implement it right away and get it in Camel 1.5
> 

Jira issue created:
https://issues.apache.org/activemq/browse/CAMEL-850



-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158327.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
Hi there,


Claus Ibsen wrote:
> 
> As a workaround you must manually "remember" the headers and set them
> after the mina stuff.
> 
Can you elaborate a little bit more or provide example?

Thanks in advance


Claus Ibsen wrote:
> 
> Could you add a ticket for the "camel-mina should preserve headers"
> feature. Then we can implement it right away and get it in Camel 1.5
> 

Jira issue created:
https://issues.apache.org/activemq/browse/CAMEL-850



-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158327.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Ah okay now I got your request. You want to preserve headers, that is a fair request currently not supported. 

As a workaround you must manually "remember" the headers and set them after the mina stuff.

Could you add a ticket for the "camel-mina should preserve headers" feature. Then we can implement it right away and get it in Camel 1.5


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 26. august 2008 10:44
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


I now about transferExchange option. That is not what I want. I do not want
to send headers over the wire to remote server, only body. I want headers
accessable after receiving response from server. Just like in http
component.



Claus Ibsen wrote:
> 
> Hi
> 
> If you want to send the payload with both body + headers then you can send
> it as plain exchange using the transferExchange=true option. Its already
> in 1.4
> 
> See the wiki documentation of the component:
> http://activemq.apache.org/camel/mina.html
> 
> And check its unit test:
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 08:41
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> Thanks for quick fix. 
> 
> I have another problem with mina component.
> There is no headers in message after mina component. Is it intentional or
> not (Because of InOut MEP)?
> 
> With your fix, that problem will not appear. Here is snippet of code
> (after
> fix) from MinaProducer class
> 
> if (ExchangeHelper.isOutCapable(exchange)) {
>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
> } else {
>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
> }
> In case of setting out message, only body is set.
> In case of setting in message all headers are preserved.
> 
> Is there workaround in Camel 1.4 for this problem or I should switch to
> Camel 1.5?
> Maybe I should try to copy In message to Out message in custom processor
> before mina? Is it good approach?
> 
> Thanks in advance
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>> don't need to change the MEP from InOnly to InOut to get the response
>> from
>> mina.
>> 
>> Also the sync option is now default = true. 99% will call a remote socket
>> server and wait for a response. 
>> 
>> CAMEL-847 was the ticket for this change.
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 25. august 2008 13:08
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
>> be
>> changed in any moment?
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> Ah you must change the exchange pattern to InOut before you send it to
>>> Mina so it can set the response on the out message body.
>>> 
>>> I guess we might need some smarter exchange pattern in Camel. Something
>>> to
>>> improve in Camel 2.0!!!
>>> 
>>> You can change the exchange pattern in Camel in your processor code (eg.
>>> debugProcessor) by casting the exchange to DefaultExchange and call the
>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>> 
>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>> beautiful solution. 
>>> 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 25. august 2008 12:14
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> I still need help regarding this problem.
>>> 
>>> I have already tried with sync option, with no results.
>>> 
>>> Here is my last route configuration:
>>> 
>>> from("timer://whcTimer?period=20000&delay=10000")
>>> .setBody(constant("0001134765 C 65405818"))
>>> .processRef("debugProcessor").to("seda:whcLog")
>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>> .processRef("debugProcessor")
>>> .to("seda:whcLog");
>>> 
>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>> 
>>> I have switch on tracing and output is following:
>>> 
>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>> Expression[null]]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>> debugProcessor]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>> debugProcessor]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:Message: null
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>>> InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>> InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>> 0001134765
>>> C 65405818
>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
>>> 14765 
>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>> Subscriber record was not created: subscriber already exists
>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>> subscriber already exists
>>> 
>>> As you can see, remote server is contacted and correct response is
>>> received,
>>> but that response is not in message body after mina component.
>>> The message is InOnly (I suppose because of timer component). That is
>>> the
>>> difference. Example in documentation is InOut (I think so).
>>> 
>>> As I said before, I am expecting behavior similar to http component.
>>> 
>>> Please help.
>>> 
>>> 
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> You need to use the sync=true option for the mina component to instruct
>>>> it
>>>> to be in synchronous mode and wait for a response.
>>>> 
>>>> See the mina documentation and read about this option.
>>>> http://activemq.apache.org/camel/mina.html
>>>> 
>>>> You use-case is documented there with a sample using textline and
>>>> sync=true.
>>>> 
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> 
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 22. august 2008 13:51
>>>> To: camel-user@activemq.apache.org
>>>> Subject: mina tcp client problem
>>>> 
>>>> 
>>>> Hi,
>>>> 
>>>> I would like to make route that will send text line to remote tcp
>>>> host:port,
>>>> read response and proceed with that response in body further in route.
>>>> I
>>>> have already make something similar with 
>>>> 
>>>> I tried with following route:
>>>> 
>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>> .setBody(constant("0001134765 C 65405818"))
>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>> .to("seda:whcLog")
>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>> .processRef("systemOutProcessor")
>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>> 
>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>> 
>>>> The log output is:
>>>> 
>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>> Entered SystemOutProcessor.
>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>> Subscriber record was not created: subscriber already exists
>>>> 
>>>> From the log you can see that mina does tcp send and receive data. But,
>>>> after mina the in message body is same as before. 
>>>> 
>>>> How to access response from remote server?
>>>> As I said, I expected behavior like in http component. I have tried
>>>> with
>>>> sync = "true" with no success.
>>>> 
>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>> XP
>>>> SP1
>>>> 
>>>> Thanks in advance
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
I saw source of your fix (847). I think that's it.
I will continue to use 1.4 with custom processor (ProducerTemplate with Mina
endpoint as you explained me before).
By the way, when do you expect release of 1.5?


Claus Ibsen wrote:
> 
> Hi
> 
> No your English is super fine - just me misunderstood the first mail.
> 
> What you want with IN only is already fixed in Camel 1.5 by CAMEL-847.
> If you use InOnly then 1.5 can set the response from mina on the IN
> message and therefore you do not need to convert InOnly to InOut as you
> have to do with Camel 1.4.
> 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 15:21
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> That's right. 
> Actually, I do not want to bother with OUT message at all. I am interested
> in IN message only. Problem arose because of workaround with setting MEP
> from InOnly to InOut.
> 
> As I said, I want behavior similar to http component. Sync request/replay
> with response in body after component and all headers preserved.
> 
> Maybe my english is problem...
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Yeah you are correct but the headers are still there on the IN message ;)
>> 
>> For example:
>> 
>> Before mina
>> ============
>> Exchange.in.header.hello=World
>> Exchange.in.body=Fine weather
>> 
>> Calling mina
>> =============
>> exchange.getOut().setBody(payload);
>> 
>> After mina
>> ==========
>> Exchange.in.header.hello=World
>> Exchange.in.body=Fine weather
>> Exchange.out.body=Result from Mina
>> 
>> 
>> But what YOU want to do is:
>> ============================
>> 
>> Before mina
>> ============
>> Exchange.in.header.hello=World
>> Exchange.in.body=Fine weather
>> 
>> Calling mina
>> =============
>> exchange.getOut().setBody(payload);
>> exchange.out.headers = copy from exchange.in.headers
>> 
>> After mina
>> ==========
>> Exchange.in.header.hello=World
>> Exchange.in.body=Fine weather
>> Exchange.out.header.hello=World
>> Exchange.out.body=Result from Mina
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 26. august 2008 14:52
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> I am pretty sure. Here is the snippet from MinaPayloadHelper class (Camel
>> 1.4):
>> 
>>     public static void setOut(Exchange exchange, Object payload) {
>>         if (payload instanceof MinaPayloadHolder) {
>>             MinaPayloadHolder.unmarshal(exchange, (MinaPayloadHolder)
>> payload);
>>         } else {
>>             // normal transfer using the body only
>>             exchange.getOut().setBody(payload);
>>         }
>>     }
>> 
>> This method is called from MinaProducer
>> As you can see only body is set. No headers at all.
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Btw: I actually do think that headers is preserved when you use
>>> camel-mina
>>> to communicate to a remote server.
>>> 
>>> I can't see why its not like this in Camel 1.4?
>>> 
>>> It only sets the response body from the remote server, on the existing
>>> original exchange. So any existing headers should still be there.
>>> 
>>> Are you sure they are lost?
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 26. august 2008 10:44
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> I now about transferExchange option. That is not what I want. I do not
>>> want
>>> to send headers over the wire to remote server, only body. I want
>>> headers
>>> accessable after receiving response from server. Just like in http
>>> component.
>>> 
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> If you want to send the payload with both body + headers then you can
>>>> send
>>>> it as plain exchange using the transferExchange=true option. Its
>>>> already
>>>> in 1.4
>>>> 
>>>> See the wiki documentation of the component:
>>>> http://activemq.apache.org/camel/mina.html
>>>> 
>>>> And check its unit test:
>>>> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
>>>> 
>>>> 
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 26. august 2008 08:41
>>>> To: camel-user@activemq.apache.org
>>>> Subject: RE: mina tcp client problem
>>>> 
>>>> 
>>>> Thanks for quick fix. 
>>>> 
>>>> I have another problem with mina component.
>>>> There is no headers in message after mina component. Is it intentional
>>>> or
>>>> not (Because of InOut MEP)?
>>>> 
>>>> With your fix, that problem will not appear. Here is snippet of code
>>>> (after
>>>> fix) from MinaProducer class
>>>> 
>>>> if (ExchangeHelper.isOutCapable(exchange)) {
>>>>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
>>>> } else {
>>>>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
>>>> }
>>>> In case of setting out message, only body is set.
>>>> In case of setting in message all headers are preserved.
>>>> 
>>>> Is there workaround in Camel 1.4 for this problem or I should switch to
>>>> Camel 1.5?
>>>> Maybe I should try to copy In message to Out message in custom
>>>> processor
>>>> before mina? Is it good approach?
>>>> 
>>>> Thanks in advance
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Claus Ibsen wrote:
>>>>> 
>>>>> Hi
>>>>> 
>>>>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>>>>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>>>>> don't need to change the MEP from InOnly to InOut to get the response
>>>>> from
>>>>> mina.
>>>>> 
>>>>> Also the sync option is now default = true. 99% will call a remote
>>>>> socket
>>>>> server and wait for a response. 
>>>>> 
>>>>> CAMEL-847 was the ticket for this change.
>>>>> 
>>>>> Med venlig hilsen
>>>>>  
>>>>> Claus Ibsen
>>>>> ......................................
>>>>> Silverbullet
>>>>> Skovsgårdsvænget 21
>>>>> 8362 Hørning
>>>>> Tlf. +45 2962 7576
>>>>> Web: www.silverbullet.dk
>>>>> 
>>>>> -----Original Message-----
>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>> Sent: 25. august 2008 13:08
>>>>> To: camel-user@activemq.apache.org
>>>>> Subject: RE: mina tcp client problem
>>>>> 
>>>>> 
>>>>> It works now. Thanks a lot. What is purpose of ExchangePattern if it
>>>>> can
>>>>> be
>>>>> changed in any moment?
>>>>> 
>>>>> 
>>>>> Claus Ibsen wrote:
>>>>>> 
>>>>>> Hi
>>>>>> 
>>>>>> Ah you must change the exchange pattern to InOut before you send it
>>>>>> to
>>>>>> Mina so it can set the response on the out message body.
>>>>>> 
>>>>>> I guess we might need some smarter exchange pattern in Camel.
>>>>>> Something
>>>>>> to
>>>>>> improve in Camel 2.0!!!
>>>>>> 
>>>>>> You can change the exchange pattern in Camel in your processor code
>>>>>> (eg.
>>>>>> debugProcessor) by casting the exchange to DefaultExchange and call
>>>>>> the
>>>>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>>>>> 
>>>>>> I guess you have a bad combination in Camel that hasn't an elegant
>>>>>> and
>>>>>> beautiful solution. 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Med venlig hilsen
>>>>>>  
>>>>>> Claus Ibsen
>>>>>> ......................................
>>>>>> Silverbullet
>>>>>> Skovsgårdsvænget 21
>>>>>> 8362 Hørning
>>>>>> Tlf. +45 2962 7576
>>>>>> Web: www.silverbullet.dk
>>>>>> -----Original Message-----
>>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>>> Sent: 25. august 2008 12:14
>>>>>> To: camel-user@activemq.apache.org
>>>>>> Subject: RE: mina tcp client problem
>>>>>> 
>>>>>> 
>>>>>> I still need help regarding this problem.
>>>>>> 
>>>>>> I have already tried with sync option, with no results.
>>>>>> 
>>>>>> Here is my last route configuration:
>>>>>> 
>>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>>> .processRef("debugProcessor").to("seda:whcLog")
>>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>>>>> .processRef("debugProcessor")
>>>>>> .to("seda:whcLog");
>>>>>> 
>>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>>> 
>>>>>> I have switch on tracing and output is following:
>>>>>> 
>>>>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>>>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>>>>> Expression[null]]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>>>> debugProcessor]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>>>> debugProcessor]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>>>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:Message: null
>>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[
>>>>>> Expression[null]]
>>>>>> InOnly Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>> 0001134765
>>>>>> C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>>>>> Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>>>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>>>>> InOnly Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>>>> Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>>>> Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG
>>>>>> asw.someLogger:73 
>>>>>> -
>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>>>>> 0001134765
>>>>>> C 65405818
>>>>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>> 0001134765
>>>>>> C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>>>>> Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>>>> Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>>>> Properties:{CamelCauseException=null,
>>>>>> org.apache.camel.timer.name=whcTimer,
>>>>>> org.apache.camel.timer.period=20000,
>>>>>> org.apache.camel.timer.time=null}
>>>>>> Headers:{} Body:0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG
>>>>>> asw.someLogger:73 
>>>>>> -
>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>>>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>>>> 00  
>>>>>> 14765 
>>>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021
>>>>>> -
>>>>>> Subscriber record was not created: subscriber already exists
>>>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>>>> 00 
>>>>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not
>>>>>> created:
>>>>>> subscriber already exists
>>>>>> 
>>>>>> As you can see, remote server is contacted and correct response is
>>>>>> received,
>>>>>> but that response is not in message body after mina component.
>>>>>> The message is InOnly (I suppose because of timer component). That is
>>>>>> the
>>>>>> difference. Example in documentation is InOut (I think so).
>>>>>> 
>>>>>> As I said before, I am expecting behavior similar to http component.
>>>>>> 
>>>>>> Please help.
>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Claus Ibsen wrote:
>>>>>>> 
>>>>>>> Hi
>>>>>>> 
>>>>>>> You need to use the sync=true option for the mina component to
>>>>>>> instruct
>>>>>>> it
>>>>>>> to be in synchronous mode and wait for a response.
>>>>>>> 
>>>>>>> See the mina documentation and read about this option.
>>>>>>> http://activemq.apache.org/camel/mina.html
>>>>>>> 
>>>>>>> You use-case is documented there with a sample using textline and
>>>>>>> sync=true.
>>>>>>> 
>>>>>>> 
>>>>>>> Med venlig hilsen
>>>>>>>  
>>>>>>> Claus Ibsen
>>>>>>> ......................................
>>>>>>> Silverbullet
>>>>>>> Skovsgårdsvænget 21
>>>>>>> 8362 Hørning
>>>>>>> Tlf. +45 2962 7576
>>>>>>> Web: www.silverbullet.dk
>>>>>>> 
>>>>>>> -----Original Message-----
>>>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>>>> Sent: 22. august 2008 13:51
>>>>>>> To: camel-user@activemq.apache.org
>>>>>>> Subject: mina tcp client problem
>>>>>>> 
>>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I would like to make route that will send text line to remote tcp
>>>>>>> host:port,
>>>>>>> read response and proceed with that response in body further in
>>>>>>> route.
>>>>>>> I
>>>>>>> have already make something similar with 
>>>>>>> 
>>>>>>> I tried with following route:
>>>>>>> 
>>>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>>>>> .to("seda:whcLog")
>>>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>>>>> .processRef("systemOutProcessor")
>>>>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>>>>> 
>>>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>>>> 
>>>>>>> The log output is:
>>>>>>> 
>>>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>>>> DEBUG
>>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>>> 0001134765
>>>>>>> C
>>>>>>> 65405818
>>>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>>>> DEBUG
>>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>>> 65405818
>>>>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG
>>>>>>> asw.someLogger:73 
>>>>>>> -
>>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>>>>> INFO 
>>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>>>> Entered SystemOutProcessor.
>>>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>>>> DEBUG
>>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>>> 0001134765
>>>>>>> C
>>>>>>> 65405818
>>>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>>>> DEBUG
>>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>>> 65405818
>>>>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG
>>>>>>> asw.someLogger:73 
>>>>>>> -
>>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021
>>>>>>> -
>>>>>>> Subscriber record was not created: subscriber already exists
>>>>>>> 
>>>>>>> From the log you can see that mina does tcp send and receive data.
>>>>>>> But,
>>>>>>> after mina the in message body is same as before. 
>>>>>>> 
>>>>>>> How to access response from remote server?
>>>>>>> As I said, I expected behavior like in http component. I have tried
>>>>>>> with
>>>>>>> sync = "true" with no success.
>>>>>>> 
>>>>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17,
>>>>>>> Windows
>>>>>>> XP
>>>>>>> SP1
>>>>>>> 
>>>>>>> Thanks in advance
>>>>>>> -- 
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> View this message in context:
>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161400.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161933.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19162190.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

No your English is super fine - just me misunderstood the first mail.

What you want with IN only is already fixed in Camel 1.5 by CAMEL-847.
If you use InOnly then 1.5 can set the response from mina on the IN message and therefore you do not need to convert InOnly to InOut as you have to do with Camel 1.4.




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 26. august 2008 15:21
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


That's right. 
Actually, I do not want to bother with OUT message at all. I am interested
in IN message only. Problem arose because of workaround with setting MEP
from InOnly to InOut.

As I said, I want behavior similar to http component. Sync request/replay
with response in body after component and all headers preserved.

Maybe my english is problem...


Claus Ibsen wrote:
> 
> Hi
> 
> Yeah you are correct but the headers are still there on the IN message ;)
> 
> For example:
> 
> Before mina
> ============
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> 
> Calling mina
> =============
> exchange.getOut().setBody(payload);
> 
> After mina
> ==========
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> Exchange.out.body=Result from Mina
> 
> 
> But what YOU want to do is:
> ============================
> 
> Before mina
> ============
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> 
> Calling mina
> =============
> exchange.getOut().setBody(payload);
> exchange.out.headers = copy from exchange.in.headers
> 
> After mina
> ==========
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> Exchange.out.header.hello=World
> Exchange.out.body=Result from Mina
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 14:52
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I am pretty sure. Here is the snippet from MinaPayloadHelper class (Camel
> 1.4):
> 
>     public static void setOut(Exchange exchange, Object payload) {
>         if (payload instanceof MinaPayloadHolder) {
>             MinaPayloadHolder.unmarshal(exchange, (MinaPayloadHolder)
> payload);
>         } else {
>             // normal transfer using the body only
>             exchange.getOut().setBody(payload);
>         }
>     }
> 
> This method is called from MinaProducer
> As you can see only body is set. No headers at all.
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Btw: I actually do think that headers is preserved when you use
>> camel-mina
>> to communicate to a remote server.
>> 
>> I can't see why its not like this in Camel 1.4?
>> 
>> It only sets the response body from the remote server, on the existing
>> original exchange. So any existing headers should still be there.
>> 
>> Are you sure they are lost?
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 26. august 2008 10:44
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> I now about transferExchange option. That is not what I want. I do not
>> want
>> to send headers over the wire to remote server, only body. I want headers
>> accessable after receiving response from server. Just like in http
>> component.
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> If you want to send the payload with both body + headers then you can
>>> send
>>> it as plain exchange using the transferExchange=true option. Its already
>>> in 1.4
>>> 
>>> See the wiki documentation of the component:
>>> http://activemq.apache.org/camel/mina.html
>>> 
>>> And check its unit test:
>>> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
>>> 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 26. august 2008 08:41
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> Thanks for quick fix. 
>>> 
>>> I have another problem with mina component.
>>> There is no headers in message after mina component. Is it intentional
>>> or
>>> not (Because of InOut MEP)?
>>> 
>>> With your fix, that problem will not appear. Here is snippet of code
>>> (after
>>> fix) from MinaProducer class
>>> 
>>> if (ExchangeHelper.isOutCapable(exchange)) {
>>>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
>>> } else {
>>>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
>>> }
>>> In case of setting out message, only body is set.
>>> In case of setting in message all headers are preserved.
>>> 
>>> Is there workaround in Camel 1.4 for this problem or I should switch to
>>> Camel 1.5?
>>> Maybe I should try to copy In message to Out message in custom processor
>>> before mina? Is it good approach?
>>> 
>>> Thanks in advance
>>> 
>>> 
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>>>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>>>> don't need to change the MEP from InOnly to InOut to get the response
>>>> from
>>>> mina.
>>>> 
>>>> Also the sync option is now default = true. 99% will call a remote
>>>> socket
>>>> server and wait for a response. 
>>>> 
>>>> CAMEL-847 was the ticket for this change.
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> 
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 25. august 2008 13:08
>>>> To: camel-user@activemq.apache.org
>>>> Subject: RE: mina tcp client problem
>>>> 
>>>> 
>>>> It works now. Thanks a lot. What is purpose of ExchangePattern if it
>>>> can
>>>> be
>>>> changed in any moment?
>>>> 
>>>> 
>>>> Claus Ibsen wrote:
>>>>> 
>>>>> Hi
>>>>> 
>>>>> Ah you must change the exchange pattern to InOut before you send it to
>>>>> Mina so it can set the response on the out message body.
>>>>> 
>>>>> I guess we might need some smarter exchange pattern in Camel.
>>>>> Something
>>>>> to
>>>>> improve in Camel 2.0!!!
>>>>> 
>>>>> You can change the exchange pattern in Camel in your processor code
>>>>> (eg.
>>>>> debugProcessor) by casting the exchange to DefaultExchange and call
>>>>> the
>>>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>>>> 
>>>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>>>> beautiful solution. 
>>>>> 
>>>>> 
>>>>> 
>>>>> Med venlig hilsen
>>>>>  
>>>>> Claus Ibsen
>>>>> ......................................
>>>>> Silverbullet
>>>>> Skovsgårdsvænget 21
>>>>> 8362 Hørning
>>>>> Tlf. +45 2962 7576
>>>>> Web: www.silverbullet.dk
>>>>> -----Original Message-----
>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>> Sent: 25. august 2008 12:14
>>>>> To: camel-user@activemq.apache.org
>>>>> Subject: RE: mina tcp client problem
>>>>> 
>>>>> 
>>>>> I still need help regarding this problem.
>>>>> 
>>>>> I have already tried with sync option, with no results.
>>>>> 
>>>>> Here is my last route configuration:
>>>>> 
>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>> .processRef("debugProcessor").to("seda:whcLog")
>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>>>> .processRef("debugProcessor")
>>>>> .to("seda:whcLog");
>>>>> 
>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>> 
>>>>> I have switch on tracing and output is following:
>>>>> 
>>>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>>>> Expression[null]]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>>> debugProcessor]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>>> debugProcessor]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:Message: null
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[
>>>>> Expression[null]]
>>>>> InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>>>> InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>>>> 0001134765
>>>>> C 65405818
>>>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>>> 00  
>>>>> 14765 
>>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>>> Subscriber record was not created: subscriber already exists
>>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>>> 00 
>>>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>>>> subscriber already exists
>>>>> 
>>>>> As you can see, remote server is contacted and correct response is
>>>>> received,
>>>>> but that response is not in message body after mina component.
>>>>> The message is InOnly (I suppose because of timer component). That is
>>>>> the
>>>>> difference. Example in documentation is InOut (I think so).
>>>>> 
>>>>> As I said before, I am expecting behavior similar to http component.
>>>>> 
>>>>> Please help.
> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Claus Ibsen wrote:
>>>>>> 
>>>>>> Hi
>>>>>> 
>>>>>> You need to use the sync=true option for the mina component to
>>>>>> instruct
>>>>>> it
>>>>>> to be in synchronous mode and wait for a response.
>>>>>> 
>>>>>> See the mina documentation and read about this option.
>>>>>> http://activemq.apache.org/camel/mina.html
>>>>>> 
>>>>>> You use-case is documented there with a sample using textline and
>>>>>> sync=true.
>>>>>> 
>>>>>> 
>>>>>> Med venlig hilsen
>>>>>>  
>>>>>> Claus Ibsen
>>>>>> ......................................
>>>>>> Silverbullet
>>>>>> Skovsgårdsvænget 21
>>>>>> 8362 Hørning
>>>>>> Tlf. +45 2962 7576
>>>>>> Web: www.silverbullet.dk
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>>> Sent: 22. august 2008 13:51
>>>>>> To: camel-user@activemq.apache.org
>>>>>> Subject: mina tcp client problem
>>>>>> 
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I would like to make route that will send text line to remote tcp
>>>>>> host:port,
>>>>>> read response and proceed with that response in body further in
>>>>>> route.
>>>>>> I
>>>>>> have already make something similar with 
>>>>>> 
>>>>>> I tried with following route:
>>>>>> 
>>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>>>> .to("seda:whcLog")
>>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>>>> .processRef("systemOutProcessor")
>>>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>>>> 
>>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>>> 
>>>>>> The log output is:
>>>>>> 
>>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>> 0001134765
>>>>>> C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG
>>>>>> asw.someLogger:73 
>>>>>> -
>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>>> Entered SystemOutProcessor.
>>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>> 0001134765
>>>>>> C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG
>>>>>> asw.someLogger:73 
>>>>>> -
>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021
>>>>>> -
>>>>>> Subscriber record was not created: subscriber already exists
>>>>>> 
>>>>>> From the log you can see that mina does tcp send and receive data.
>>>>>> But,
>>>>>> after mina the in message body is same as before. 
>>>>>> 
>>>>>> How to access response from remote server?
>>>>>> As I said, I expected behavior like in http component. I have tried
>>>>>> with
>>>>>> sync = "true" with no success.
>>>>>> 
>>>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>>>> XP
>>>>>> SP1
>>>>>> 
>>>>>> Thanks in advance
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> View this message in context:
>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161933.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
That's right. 
Actually, I do not want to bother with OUT message at all. I am interested
in IN message only. Problem arose because of workaround with setting MEP
from InOnly to InOut.

As I said, I want behavior similar to http component. Sync request/replay
with response in body after component and all headers preserved.

Maybe my english is problem...


Claus Ibsen wrote:
> 
> Hi
> 
> Yeah you are correct but the headers are still there on the IN message ;)
> 
> For example:
> 
> Before mina
> ============
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> 
> Calling mina
> =============
> exchange.getOut().setBody(payload);
> 
> After mina
> ==========
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> Exchange.out.body=Result from Mina
> 
> 
> But what YOU want to do is:
> ============================
> 
> Before mina
> ============
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> 
> Calling mina
> =============
> exchange.getOut().setBody(payload);
> exchange.out.headers = copy from exchange.in.headers
> 
> After mina
> ==========
> Exchange.in.header.hello=World
> Exchange.in.body=Fine weather
> Exchange.out.header.hello=World
> Exchange.out.body=Result from Mina
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 14:52
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I am pretty sure. Here is the snippet from MinaPayloadHelper class (Camel
> 1.4):
> 
>     public static void setOut(Exchange exchange, Object payload) {
>         if (payload instanceof MinaPayloadHolder) {
>             MinaPayloadHolder.unmarshal(exchange, (MinaPayloadHolder)
> payload);
>         } else {
>             // normal transfer using the body only
>             exchange.getOut().setBody(payload);
>         }
>     }
> 
> This method is called from MinaProducer
> As you can see only body is set. No headers at all.
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Btw: I actually do think that headers is preserved when you use
>> camel-mina
>> to communicate to a remote server.
>> 
>> I can't see why its not like this in Camel 1.4?
>> 
>> It only sets the response body from the remote server, on the existing
>> original exchange. So any existing headers should still be there.
>> 
>> Are you sure they are lost?
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 26. august 2008 10:44
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> I now about transferExchange option. That is not what I want. I do not
>> want
>> to send headers over the wire to remote server, only body. I want headers
>> accessable after receiving response from server. Just like in http
>> component.
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> If you want to send the payload with both body + headers then you can
>>> send
>>> it as plain exchange using the transferExchange=true option. Its already
>>> in 1.4
>>> 
>>> See the wiki documentation of the component:
>>> http://activemq.apache.org/camel/mina.html
>>> 
>>> And check its unit test:
>>> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
>>> 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 26. august 2008 08:41
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> Thanks for quick fix. 
>>> 
>>> I have another problem with mina component.
>>> There is no headers in message after mina component. Is it intentional
>>> or
>>> not (Because of InOut MEP)?
>>> 
>>> With your fix, that problem will not appear. Here is snippet of code
>>> (after
>>> fix) from MinaProducer class
>>> 
>>> if (ExchangeHelper.isOutCapable(exchange)) {
>>>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
>>> } else {
>>>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
>>> }
>>> In case of setting out message, only body is set.
>>> In case of setting in message all headers are preserved.
>>> 
>>> Is there workaround in Camel 1.4 for this problem or I should switch to
>>> Camel 1.5?
>>> Maybe I should try to copy In message to Out message in custom processor
>>> before mina? Is it good approach?
>>> 
>>> Thanks in advance
>>> 
>>> 
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>>>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>>>> don't need to change the MEP from InOnly to InOut to get the response
>>>> from
>>>> mina.
>>>> 
>>>> Also the sync option is now default = true. 99% will call a remote
>>>> socket
>>>> server and wait for a response. 
>>>> 
>>>> CAMEL-847 was the ticket for this change.
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> 
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 25. august 2008 13:08
>>>> To: camel-user@activemq.apache.org
>>>> Subject: RE: mina tcp client problem
>>>> 
>>>> 
>>>> It works now. Thanks a lot. What is purpose of ExchangePattern if it
>>>> can
>>>> be
>>>> changed in any moment?
>>>> 
>>>> 
>>>> Claus Ibsen wrote:
>>>>> 
>>>>> Hi
>>>>> 
>>>>> Ah you must change the exchange pattern to InOut before you send it to
>>>>> Mina so it can set the response on the out message body.
>>>>> 
>>>>> I guess we might need some smarter exchange pattern in Camel.
>>>>> Something
>>>>> to
>>>>> improve in Camel 2.0!!!
>>>>> 
>>>>> You can change the exchange pattern in Camel in your processor code
>>>>> (eg.
>>>>> debugProcessor) by casting the exchange to DefaultExchange and call
>>>>> the
>>>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>>>> 
>>>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>>>> beautiful solution. 
>>>>> 
>>>>> 
>>>>> 
>>>>> Med venlig hilsen
>>>>>  
>>>>> Claus Ibsen
>>>>> ......................................
>>>>> Silverbullet
>>>>> Skovsgårdsvænget 21
>>>>> 8362 Hørning
>>>>> Tlf. +45 2962 7576
>>>>> Web: www.silverbullet.dk
>>>>> -----Original Message-----
>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>> Sent: 25. august 2008 12:14
>>>>> To: camel-user@activemq.apache.org
>>>>> Subject: RE: mina tcp client problem
>>>>> 
>>>>> 
>>>>> I still need help regarding this problem.
>>>>> 
>>>>> I have already tried with sync option, with no results.
>>>>> 
>>>>> Here is my last route configuration:
>>>>> 
>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>> .processRef("debugProcessor").to("seda:whcLog")
>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>>>> .processRef("debugProcessor")
>>>>> .to("seda:whcLog");
>>>>> 
>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>> 
>>>>> I have switch on tracing and output is following:
>>>>> 
>>>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>>>> Expression[null]]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>>> debugProcessor]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>>> debugProcessor]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:Message: null
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[
>>>>> Expression[null]]
>>>>> InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>>>> InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>>>> 0001134765
>>>>> C 65405818
>>>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000,
>>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>>> Properties:{CamelCauseException=null,
>>>>> org.apache.camel.timer.name=whcTimer,
>>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>>> Headers:{} Body:0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>>> 00  
>>>>> 14765 
>>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>>> Subscriber record was not created: subscriber already exists
>>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>>> 00 
>>>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>>>> subscriber already exists
>>>>> 
>>>>> As you can see, remote server is contacted and correct response is
>>>>> received,
>>>>> but that response is not in message body after mina component.
>>>>> The message is InOnly (I suppose because of timer component). That is
>>>>> the
>>>>> difference. Example in documentation is InOut (I think so).
>>>>> 
>>>>> As I said before, I am expecting behavior similar to http component.
>>>>> 
>>>>> Please help.
> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Claus Ibsen wrote:
>>>>>> 
>>>>>> Hi
>>>>>> 
>>>>>> You need to use the sync=true option for the mina component to
>>>>>> instruct
>>>>>> it
>>>>>> to be in synchronous mode and wait for a response.
>>>>>> 
>>>>>> See the mina documentation and read about this option.
>>>>>> http://activemq.apache.org/camel/mina.html
>>>>>> 
>>>>>> You use-case is documented there with a sample using textline and
>>>>>> sync=true.
>>>>>> 
>>>>>> 
>>>>>> Med venlig hilsen
>>>>>>  
>>>>>> Claus Ibsen
>>>>>> ......................................
>>>>>> Silverbullet
>>>>>> Skovsgårdsvænget 21
>>>>>> 8362 Hørning
>>>>>> Tlf. +45 2962 7576
>>>>>> Web: www.silverbullet.dk
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>>> Sent: 22. august 2008 13:51
>>>>>> To: camel-user@activemq.apache.org
>>>>>> Subject: mina tcp client problem
>>>>>> 
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I would like to make route that will send text line to remote tcp
>>>>>> host:port,
>>>>>> read response and proceed with that response in body further in
>>>>>> route.
>>>>>> I
>>>>>> have already make something similar with 
>>>>>> 
>>>>>> I tried with following route:
>>>>>> 
>>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>>>> .to("seda:whcLog")
>>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>>>> .processRef("systemOutProcessor")
>>>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>>>> 
>>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>>> 
>>>>>> The log output is:
>>>>>> 
>>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>> 0001134765
>>>>>> C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG
>>>>>> asw.someLogger:73 
>>>>>> -
>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>>>> INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>>> Entered SystemOutProcessor.
>>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>>> 0001134765
>>>>>> C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>>> DEBUG
>>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>>> 65405818
>>>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG
>>>>>> asw.someLogger:73 
>>>>>> -
>>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021
>>>>>> -
>>>>>> Subscriber record was not created: subscriber already exists
>>>>>> 
>>>>>> From the log you can see that mina does tcp send and receive data.
>>>>>> But,
>>>>>> after mina the in message body is same as before. 
>>>>>> 
>>>>>> How to access response from remote server?
>>>>>> As I said, I expected behavior like in http component. I have tried
>>>>>> with
>>>>>> sync = "true" with no success.
>>>>>> 
>>>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>>>> XP
>>>>>> SP1
>>>>>> 
>>>>>> Thanks in advance
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> View this message in context:
>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161933.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Yeah you are correct but the headers are still there on the IN message ;)

For example:

Before mina
============
Exchange.in.header.hello=World
Exchange.in.body=Fine weather

Calling mina
=============
exchange.getOut().setBody(payload);

After mina
==========
Exchange.in.header.hello=World
Exchange.in.body=Fine weather
Exchange.out.body=Result from Mina


But what YOU want to do is:
============================

Before mina
============
Exchange.in.header.hello=World
Exchange.in.body=Fine weather

Calling mina
=============
exchange.getOut().setBody(payload);
exchange.out.headers = copy from exchange.in.headers

After mina
==========
Exchange.in.header.hello=World
Exchange.in.body=Fine weather
Exchange.out.header.hello=World
Exchange.out.body=Result from Mina



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 26. august 2008 14:52
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


I am pretty sure. Here is the snippet from MinaPayloadHelper class (Camel
1.4):

    public static void setOut(Exchange exchange, Object payload) {
        if (payload instanceof MinaPayloadHolder) {
            MinaPayloadHolder.unmarshal(exchange, (MinaPayloadHolder)
payload);
        } else {
            // normal transfer using the body only
            exchange.getOut().setBody(payload);
        }
    }

This method is called from MinaProducer
As you can see only body is set. No headers at all.



Claus Ibsen wrote:
> 
> Btw: I actually do think that headers is preserved when you use camel-mina
> to communicate to a remote server.
> 
> I can't see why its not like this in Camel 1.4?
> 
> It only sets the response body from the remote server, on the existing
> original exchange. So any existing headers should still be there.
> 
> Are you sure they are lost?
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 10:44
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I now about transferExchange option. That is not what I want. I do not
> want
> to send headers over the wire to remote server, only body. I want headers
> accessable after receiving response from server. Just like in http
> component.
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> If you want to send the payload with both body + headers then you can
>> send
>> it as plain exchange using the transferExchange=true option. Its already
>> in 1.4
>> 
>> See the wiki documentation of the component:
>> http://activemq.apache.org/camel/mina.html
>> 
>> And check its unit test:
>> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 26. august 2008 08:41
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> Thanks for quick fix. 
>> 
>> I have another problem with mina component.
>> There is no headers in message after mina component. Is it intentional or
>> not (Because of InOut MEP)?
>> 
>> With your fix, that problem will not appear. Here is snippet of code
>> (after
>> fix) from MinaProducer class
>> 
>> if (ExchangeHelper.isOutCapable(exchange)) {
>>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
>> } else {
>>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
>> }
>> In case of setting out message, only body is set.
>> In case of setting in message all headers are preserved.
>> 
>> Is there workaround in Camel 1.4 for this problem or I should switch to
>> Camel 1.5?
>> Maybe I should try to copy In message to Out message in custom processor
>> before mina? Is it good approach?
>> 
>> Thanks in advance
>> 
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>>> don't need to change the MEP from InOnly to InOut to get the response
>>> from
>>> mina.
>>> 
>>> Also the sync option is now default = true. 99% will call a remote
>>> socket
>>> server and wait for a response. 
>>> 
>>> CAMEL-847 was the ticket for this change.
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 25. august 2008 13:08
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
>>> be
>>> changed in any moment?
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> Ah you must change the exchange pattern to InOut before you send it to
>>>> Mina so it can set the response on the out message body.
>>>> 
>>>> I guess we might need some smarter exchange pattern in Camel. Something
>>>> to
>>>> improve in Camel 2.0!!!
>>>> 
>>>> You can change the exchange pattern in Camel in your processor code
>>>> (eg.
>>>> debugProcessor) by casting the exchange to DefaultExchange and call the
>>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>>> 
>>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>>> beautiful solution. 
>>>> 
>>>> 
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 25. august 2008 12:14
>>>> To: camel-user@activemq.apache.org
>>>> Subject: RE: mina tcp client problem
>>>> 
>>>> 
>>>> I still need help regarding this problem.
>>>> 
>>>> I have already tried with sync option, with no results.
>>>> 
>>>> Here is my last route configuration:
>>>> 
>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>> .setBody(constant("0001134765 C 65405818"))
>>>> .processRef("debugProcessor").to("seda:whcLog")
>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>>> .processRef("debugProcessor")
>>>> .to("seda:whcLog");
>>>> 
>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>> 
>>>> I have switch on tracing and output is following:
>>>> 
>>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>>> Expression[null]]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>> debugProcessor]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>> debugProcessor]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:Message: null
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>>>> InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>>> InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>>> 0001134765
>>>> C 65405818
>>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>> 00  
>>>> 14765 
>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>> Subscriber record was not created: subscriber already exists
>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>> 00 
>>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>>> subscriber already exists
>>>> 
>>>> As you can see, remote server is contacted and correct response is
>>>> received,
>>>> but that response is not in message body after mina component.
>>>> The message is InOnly (I suppose because of timer component). That is
>>>> the
>>>> difference. Example in documentation is InOut (I think so).
>>>> 
>>>> As I said before, I am expecting behavior similar to http component.
>>>> 
>>>> Please help.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Claus Ibsen wrote:
>>>>> 
>>>>> Hi
>>>>> 
>>>>> You need to use the sync=true option for the mina component to
>>>>> instruct
>>>>> it
>>>>> to be in synchronous mode and wait for a response.
>>>>> 
>>>>> See the mina documentation and read about this option.
>>>>> http://activemq.apache.org/camel/mina.html
>>>>> 
>>>>> You use-case is documented there with a sample using textline and
>>>>> sync=true.
>>>>> 
>>>>> 
>>>>> Med venlig hilsen
>>>>>  
>>>>> Claus Ibsen
>>>>> ......................................
>>>>> Silverbullet
>>>>> Skovsgårdsvænget 21
>>>>> 8362 Hørning
>>>>> Tlf. +45 2962 7576
>>>>> Web: www.silverbullet.dk
>>>>> 
>>>>> -----Original Message-----
>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>> Sent: 22. august 2008 13:51
>>>>> To: camel-user@activemq.apache.org
>>>>> Subject: mina tcp client problem
>>>>> 
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I would like to make route that will send text line to remote tcp
>>>>> host:port,
>>>>> read response and proceed with that response in body further in route.
>>>>> I
>>>>> have already make something similar with 
>>>>> 
>>>>> I tried with following route:
>>>>> 
>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>>> .to("seda:whcLog")
>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>>> .processRef("systemOutProcessor")
>>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>>> 
>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>> 
>>>>> The log output is:
>>>>> 
>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>> Entered SystemOutProcessor.
>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>>> Subscriber record was not created: subscriber already exists
>>>>> 
>>>>> From the log you can see that mina does tcp send and receive data.
>>>>> But,
>>>>> after mina the in message body is same as before. 
>>>>> 
>>>>> How to access response from remote server?
>>>>> As I said, I expected behavior like in http component. I have tried
>>>>> with
>>>>> sync = "true" with no success.
>>>>> 
>>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>>> XP
>>>>> SP1
>>>>> 
>>>>> Thanks in advance
>>>>> -- 
>>>>> View this message in context:
>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161400.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
I am pretty sure. Here is the snippet from MinaPayloadHelper class (Camel
1.4):

    public static void setOut(Exchange exchange, Object payload) {
        if (payload instanceof MinaPayloadHolder) {
            MinaPayloadHolder.unmarshal(exchange, (MinaPayloadHolder)
payload);
        } else {
            // normal transfer using the body only
            exchange.getOut().setBody(payload);
        }
    }

This method is called from MinaProducer
As you can see only body is set. No headers at all.



Claus Ibsen wrote:
> 
> Btw: I actually do think that headers is preserved when you use camel-mina
> to communicate to a remote server.
> 
> I can't see why its not like this in Camel 1.4?
> 
> It only sets the response body from the remote server, on the existing
> original exchange. So any existing headers should still be there.
> 
> Are you sure they are lost?
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 10:44
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I now about transferExchange option. That is not what I want. I do not
> want
> to send headers over the wire to remote server, only body. I want headers
> accessable after receiving response from server. Just like in http
> component.
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> If you want to send the payload with both body + headers then you can
>> send
>> it as plain exchange using the transferExchange=true option. Its already
>> in 1.4
>> 
>> See the wiki documentation of the component:
>> http://activemq.apache.org/camel/mina.html
>> 
>> And check its unit test:
>> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 26. august 2008 08:41
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> Thanks for quick fix. 
>> 
>> I have another problem with mina component.
>> There is no headers in message after mina component. Is it intentional or
>> not (Because of InOut MEP)?
>> 
>> With your fix, that problem will not appear. Here is snippet of code
>> (after
>> fix) from MinaProducer class
>> 
>> if (ExchangeHelper.isOutCapable(exchange)) {
>>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
>> } else {
>>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
>> }
>> In case of setting out message, only body is set.
>> In case of setting in message all headers are preserved.
>> 
>> Is there workaround in Camel 1.4 for this problem or I should switch to
>> Camel 1.5?
>> Maybe I should try to copy In message to Out message in custom processor
>> before mina? Is it good approach?
>> 
>> Thanks in advance
>> 
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>>> don't need to change the MEP from InOnly to InOut to get the response
>>> from
>>> mina.
>>> 
>>> Also the sync option is now default = true. 99% will call a remote
>>> socket
>>> server and wait for a response. 
>>> 
>>> CAMEL-847 was the ticket for this change.
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 25. august 2008 13:08
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
>>> be
>>> changed in any moment?
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> Ah you must change the exchange pattern to InOut before you send it to
>>>> Mina so it can set the response on the out message body.
>>>> 
>>>> I guess we might need some smarter exchange pattern in Camel. Something
>>>> to
>>>> improve in Camel 2.0!!!
>>>> 
>>>> You can change the exchange pattern in Camel in your processor code
>>>> (eg.
>>>> debugProcessor) by casting the exchange to DefaultExchange and call the
>>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>>> 
>>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>>> beautiful solution. 
>>>> 
>>>> 
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 25. august 2008 12:14
>>>> To: camel-user@activemq.apache.org
>>>> Subject: RE: mina tcp client problem
>>>> 
>>>> 
>>>> I still need help regarding this problem.
>>>> 
>>>> I have already tried with sync option, with no results.
>>>> 
>>>> Here is my last route configuration:
>>>> 
>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>> .setBody(constant("0001134765 C 65405818"))
>>>> .processRef("debugProcessor").to("seda:whcLog")
>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>>> .processRef("debugProcessor")
>>>> .to("seda:whcLog");
>>>> 
>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>> 
>>>> I have switch on tracing and output is following:
>>>> 
>>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>>> Expression[null]]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>> debugProcessor]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>>> debugProcessor]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:Message: null
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>>>> InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>>> InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>>> 0001134765
>>>> C 65405818
>>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000,
>>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>>> Properties:{CamelCauseException=null,
>>>> org.apache.camel.timer.name=whcTimer,
>>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>>> Headers:{} Body:0001134765 C 65405818
>>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>> 00  
>>>> 14765 
>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>> Subscriber record was not created: subscriber already exists
>>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>>> org.apache.camel.component.mina.MinaProducer:166  - Message received:
>>>> 00 
>>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>>> subscriber already exists
>>>> 
>>>> As you can see, remote server is contacted and correct response is
>>>> received,
>>>> but that response is not in message body after mina component.
>>>> The message is InOnly (I suppose because of timer component). That is
>>>> the
>>>> difference. Example in documentation is InOut (I think so).
>>>> 
>>>> As I said before, I am expecting behavior similar to http component.
>>>> 
>>>> Please help.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Claus Ibsen wrote:
>>>>> 
>>>>> Hi
>>>>> 
>>>>> You need to use the sync=true option for the mina component to
>>>>> instruct
>>>>> it
>>>>> to be in synchronous mode and wait for a response.
>>>>> 
>>>>> See the mina documentation and read about this option.
>>>>> http://activemq.apache.org/camel/mina.html
>>>>> 
>>>>> You use-case is documented there with a sample using textline and
>>>>> sync=true.
>>>>> 
>>>>> 
>>>>> Med venlig hilsen
>>>>>  
>>>>> Claus Ibsen
>>>>> ......................................
>>>>> Silverbullet
>>>>> Skovsgårdsvænget 21
>>>>> 8362 Hørning
>>>>> Tlf. +45 2962 7576
>>>>> Web: www.silverbullet.dk
>>>>> 
>>>>> -----Original Message-----
>>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>>> Sent: 22. august 2008 13:51
>>>>> To: camel-user@activemq.apache.org
>>>>> Subject: mina tcp client problem
>>>>> 
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I would like to make route that will send text line to remote tcp
>>>>> host:port,
>>>>> read response and proceed with that response in body further in route.
>>>>> I
>>>>> have already make something similar with 
>>>>> 
>>>>> I tried with following route:
>>>>> 
>>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>>> .setBody(constant("0001134765 C 65405818"))
>>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>>> .to("seda:whcLog")
>>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>>> .processRef("systemOutProcessor")
>>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>>> 
>>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>>> 
>>>>> The log output is:
>>>>> 
>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>>> INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>>> Entered SystemOutProcessor.
>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message:
>>>>> 0001134765
>>>>> C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>>> DEBUG
>>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>>> 65405818
>>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>>> -
>>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>>> Subscriber record was not created: subscriber already exists
>>>>> 
>>>>> From the log you can see that mina does tcp send and receive data.
>>>>> But,
>>>>> after mina the in message body is same as before. 
>>>>> 
>>>>> How to access response from remote server?
>>>>> As I said, I expected behavior like in http component. I have tried
>>>>> with
>>>>> sync = "true" with no success.
>>>>> 
>>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>>> XP
>>>>> SP1
>>>>> 
>>>>> Thanks in advance
>>>>> -- 
>>>>> View this message in context:
>>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19161400.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Btw: I actually do think that headers is preserved when you use camel-mina to communicate to a remote server.

I can't see why its not like this in Camel 1.4?

It only sets the response body from the remote server, on the existing original exchange. So any existing headers should still be there.

Are you sure they are lost?


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 26. august 2008 10:44
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


I now about transferExchange option. That is not what I want. I do not want
to send headers over the wire to remote server, only body. I want headers
accessable after receiving response from server. Just like in http
component.



Claus Ibsen wrote:
> 
> Hi
> 
> If you want to send the payload with both body + headers then you can send
> it as plain exchange using the transferExchange=true option. Its already
> in 1.4
> 
> See the wiki documentation of the component:
> http://activemq.apache.org/camel/mina.html
> 
> And check its unit test:
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 08:41
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> Thanks for quick fix. 
> 
> I have another problem with mina component.
> There is no headers in message after mina component. Is it intentional or
> not (Because of InOut MEP)?
> 
> With your fix, that problem will not appear. Here is snippet of code
> (after
> fix) from MinaProducer class
> 
> if (ExchangeHelper.isOutCapable(exchange)) {
>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
> } else {
>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
> }
> In case of setting out message, only body is set.
> In case of setting in message all headers are preserved.
> 
> Is there workaround in Camel 1.4 for this problem or I should switch to
> Camel 1.5?
> Maybe I should try to copy In message to Out message in custom processor
> before mina? Is it good approach?
> 
> Thanks in advance
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>> don't need to change the MEP from InOnly to InOut to get the response
>> from
>> mina.
>> 
>> Also the sync option is now default = true. 99% will call a remote socket
>> server and wait for a response. 
>> 
>> CAMEL-847 was the ticket for this change.
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 25. august 2008 13:08
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
>> be
>> changed in any moment?
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> Ah you must change the exchange pattern to InOut before you send it to
>>> Mina so it can set the response on the out message body.
>>> 
>>> I guess we might need some smarter exchange pattern in Camel. Something
>>> to
>>> improve in Camel 2.0!!!
>>> 
>>> You can change the exchange pattern in Camel in your processor code (eg.
>>> debugProcessor) by casting the exchange to DefaultExchange and call the
>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>> 
>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>> beautiful solution. 
>>> 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 25. august 2008 12:14
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> I still need help regarding this problem.
>>> 
>>> I have already tried with sync option, with no results.
>>> 
>>> Here is my last route configuration:
>>> 
>>> from("timer://whcTimer?period=20000&delay=10000")
>>> .setBody(constant("0001134765 C 65405818"))
>>> .processRef("debugProcessor").to("seda:whcLog")
>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>> .processRef("debugProcessor")
>>> .to("seda:whcLog");
>>> 
>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>> 
>>> I have switch on tracing and output is following:
>>> 
>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>> Expression[null]]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>> debugProcessor]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>> debugProcessor]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:Message: null
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>>> InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>> InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>> 0001134765
>>> C 65405818
>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
>>> 14765 
>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>> Subscriber record was not created: subscriber already exists
>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>> subscriber already exists
>>> 
>>> As you can see, remote server is contacted and correct response is
>>> received,
>>> but that response is not in message body after mina component.
>>> The message is InOnly (I suppose because of timer component). That is
>>> the
>>> difference. Example in documentation is InOut (I think so).
>>> 
>>> As I said before, I am expecting behavior similar to http component.
>>> 
>>> Please help.
>>> 
>>> 
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> You need to use the sync=true option for the mina component to instruct
>>>> it
>>>> to be in synchronous mode and wait for a response.
>>>> 
>>>> See the mina documentation and read about this option.
>>>> http://activemq.apache.org/camel/mina.html
>>>> 
>>>> You use-case is documented there with a sample using textline and
>>>> sync=true.
>>>> 
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> 
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 22. august 2008 13:51
>>>> To: camel-user@activemq.apache.org
>>>> Subject: mina tcp client problem
>>>> 
>>>> 
>>>> Hi,
>>>> 
>>>> I would like to make route that will send text line to remote tcp
>>>> host:port,
>>>> read response and proceed with that response in body further in route.
>>>> I
>>>> have already make something similar with 
>>>> 
>>>> I tried with following route:
>>>> 
>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>> .setBody(constant("0001134765 C 65405818"))
>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>> .to("seda:whcLog")
>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>> .processRef("systemOutProcessor")
>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>> 
>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>> 
>>>> The log output is:
>>>> 
>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>> Entered SystemOutProcessor.
>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>> Subscriber record was not created: subscriber already exists
>>>> 
>>>> From the log you can see that mina does tcp send and receive data. But,
>>>> after mina the in message body is same as before. 
>>>> 
>>>> How to access response from remote server?
>>>> As I said, I expected behavior like in http component. I have tried
>>>> with
>>>> sync = "true" with no success.
>>>> 
>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>> XP
>>>> SP1
>>>> 
>>>> Thanks in advance
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
I now about transferExchange option. That is not what I want. I do not want
to send headers over the wire to remote server, only body. I want headers
accessable after receiving response from server. Just like in http
component.



Claus Ibsen wrote:
> 
> Hi
> 
> If you want to send the payload with both body + headers then you can send
> it as plain exchange using the transferExchange=true option. Its already
> in 1.4
> 
> See the wiki documentation of the component:
> http://activemq.apache.org/camel/mina.html
> 
> And check its unit test:
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 26. august 2008 08:41
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> Thanks for quick fix. 
> 
> I have another problem with mina component.
> There is no headers in message after mina component. Is it intentional or
> not (Because of InOut MEP)?
> 
> With your fix, that problem will not appear. Here is snippet of code
> (after
> fix) from MinaProducer class
> 
> if (ExchangeHelper.isOutCapable(exchange)) {
>     MinaPayloadHelper.setOut(exchange, handler.getMessage());
> } else {
>     MinaPayloadHelper.setIn(exchange, handler.getMessage());
> }
> In case of setting out message, only body is set.
> In case of setting in message all headers are preserved.
> 
> Is there workaround in Camel 1.4 for this problem or I should switch to
> Camel 1.5?
> Maybe I should try to copy In message to Out message in custom processor
> before mina? Is it good approach?
> 
> Thanks in advance
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
>> support your use-case out-of-the-box in Camel 1.5. So at that time you
>> don't need to change the MEP from InOnly to InOut to get the response
>> from
>> mina.
>> 
>> Also the sync option is now default = true. 99% will call a remote socket
>> server and wait for a response. 
>> 
>> CAMEL-847 was the ticket for this change.
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 25. august 2008 13:08
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
>> be
>> changed in any moment?
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> Ah you must change the exchange pattern to InOut before you send it to
>>> Mina so it can set the response on the out message body.
>>> 
>>> I guess we might need some smarter exchange pattern in Camel. Something
>>> to
>>> improve in Camel 2.0!!!
>>> 
>>> You can change the exchange pattern in Camel in your processor code (eg.
>>> debugProcessor) by casting the exchange to DefaultExchange and call the
>>> setExchangePattern(InOut) to change it from InOnly to InOut
>>> 
>>> I guess you have a bad combination in Camel that hasn't an elegant and
>>> beautiful solution. 
>>> 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 25. august 2008 12:14
>>> To: camel-user@activemq.apache.org
>>> Subject: RE: mina tcp client problem
>>> 
>>> 
>>> I still need help regarding this problem.
>>> 
>>> I have already tried with sync option, with no results.
>>> 
>>> Here is my last route configuration:
>>> 
>>> from("timer://whcTimer?period=20000&delay=10000")
>>> .setBody(constant("0001134765 C 65405818"))
>>> .processRef("debugProcessor").to("seda:whcLog")
>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>>> .processRef("debugProcessor")
>>> .to("seda:whcLog");
>>> 
>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>> 
>>> I have switch on tracing and output is following:
>>> 
>>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>>> Expression[null]]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>> debugProcessor]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>>> debugProcessor]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]],
>>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>>> Properties:{org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:Message: null
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>>> InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to2
>>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>>> InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>>> 0001134765
>>> C 65405818
>>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000,
>>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>>> ID-drasko/3530-1219658769328/2-0 -> to4
>>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>>> Properties:{CamelCauseException=null,
>>> org.apache.camel.timer.name=whcTimer,
>>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>>> Headers:{} Body:0001134765 C 65405818
>>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
>>> 14765 
>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>> Subscriber record was not created: subscriber already exists
>>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
>>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>>> subscriber already exists
>>> 
>>> As you can see, remote server is contacted and correct response is
>>> received,
>>> but that response is not in message body after mina component.
>>> The message is InOnly (I suppose because of timer component). That is
>>> the
>>> difference. Example in documentation is InOut (I think so).
>>> 
>>> As I said before, I am expecting behavior similar to http component.
>>> 
>>> Please help.
>>> 
>>> 
>>> 
>>> 
>>> Claus Ibsen wrote:
>>>> 
>>>> Hi
>>>> 
>>>> You need to use the sync=true option for the mina component to instruct
>>>> it
>>>> to be in synchronous mode and wait for a response.
>>>> 
>>>> See the mina documentation and read about this option.
>>>> http://activemq.apache.org/camel/mina.html
>>>> 
>>>> You use-case is documented there with a sample using textline and
>>>> sync=true.
>>>> 
>>>> 
>>>> Med venlig hilsen
>>>>  
>>>> Claus Ibsen
>>>> ......................................
>>>> Silverbullet
>>>> Skovsgårdsvænget 21
>>>> 8362 Hørning
>>>> Tlf. +45 2962 7576
>>>> Web: www.silverbullet.dk
>>>> 
>>>> -----Original Message-----
>>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>>> Sent: 22. august 2008 13:51
>>>> To: camel-user@activemq.apache.org
>>>> Subject: mina tcp client problem
>>>> 
>>>> 
>>>> Hi,
>>>> 
>>>> I would like to make route that will send text line to remote tcp
>>>> host:port,
>>>> read response and proceed with that response in body further in route.
>>>> I
>>>> have already make something similar with 
>>>> 
>>>> I tried with following route:
>>>> 
>>>> from("timer://whcTimer?period=20000&delay=10000")
>>>> .setBody(constant("0001134765 C 65405818"))
>>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>>> .to("seda:whcLog")
>>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>>> .processRef("systemOutProcessor")
>>>> .processRef("debugProcessor").to("seda:whcLog");
>>>> 
>>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>>> 
>>>> The log output is:
>>>> 
>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000]
>>>> INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>>> Entered SystemOutProcessor.
>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>>> C
>>>> 65405818
>>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>>> DEBUG
>>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>>> 65405818
>>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>>> -
>>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>>> Subscriber record was not created: subscriber already exists
>>>> 
>>>> From the log you can see that mina does tcp send and receive data. But,
>>>> after mina the in message body is same as before. 
>>>> 
>>>> How to access response from remote server?
>>>> As I said, I expected behavior like in http component. I have tried
>>>> with
>>>> sync = "true" with no success.
>>>> 
>>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows
>>>> XP
>>>> SP1
>>>> 
>>>> Thanks in advance
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19158051.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

If you want to send the payload with both body + headers then you can send it as plain exchange using the transferExchange=true option. Its already in 1.4

See the wiki documentation of the component:
http://activemq.apache.org/camel/mina.html

And check its unit test:
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 26. august 2008 08:41
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


Thanks for quick fix. 

I have another problem with mina component.
There is no headers in message after mina component. Is it intentional or
not (Because of InOut MEP)?

With your fix, that problem will not appear. Here is snippet of code (after
fix) from MinaProducer class

if (ExchangeHelper.isOutCapable(exchange)) {
    MinaPayloadHelper.setOut(exchange, handler.getMessage());
} else {
    MinaPayloadHelper.setIn(exchange, handler.getMessage());
}
In case of setting out message, only body is set.
In case of setting in message all headers are preserved.

Is there workaround in Camel 1.4 for this problem or I should switch to
Camel 1.5?
Maybe I should try to copy In message to Out message in custom processor
before mina? Is it good approach?

Thanks in advance




Claus Ibsen wrote:
> 
> Hi
> 
> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
> support your use-case out-of-the-box in Camel 1.5. So at that time you
> don't need to change the MEP from InOnly to InOut to get the response from
> mina.
> 
> Also the sync option is now default = true. 99% will call a remote socket
> server and wait for a response. 
> 
> CAMEL-847 was the ticket for this change.
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 25. august 2008 13:08
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
> be
> changed in any moment?
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Ah you must change the exchange pattern to InOut before you send it to
>> Mina so it can set the response on the out message body.
>> 
>> I guess we might need some smarter exchange pattern in Camel. Something
>> to
>> improve in Camel 2.0!!!
>> 
>> You can change the exchange pattern in Camel in your processor code (eg.
>> debugProcessor) by casting the exchange to DefaultExchange and call the
>> setExchangePattern(InOut) to change it from InOnly to InOut
>> 
>> I guess you have a bad combination in Camel that hasn't an elegant and
>> beautiful solution. 
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 25. august 2008 12:14
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> I still need help regarding this problem.
>> 
>> I have already tried with sync option, with no results.
>> 
>> Here is my last route configuration:
>> 
>> from("timer://whcTimer?period=20000&delay=10000")
>> .setBody(constant("0001134765 C 65405818"))
>> .processRef("debugProcessor").to("seda:whcLog")
>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>> .processRef("debugProcessor")
>> .to("seda:whcLog");
>> 
>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>> 
>> I have switch on tracing and output is following:
>> 
>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>> Expression[null]]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>> debugProcessor]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>> debugProcessor]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>> Properties:{org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:Message: null
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>> InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to2
>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>> InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to4
>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>> 0001134765
>> C 65405818
>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to4
>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
>> 14765 
>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>> Subscriber record was not created: subscriber already exists
>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>> subscriber already exists
>> 
>> As you can see, remote server is contacted and correct response is
>> received,
>> but that response is not in message body after mina component.
>> The message is InOnly (I suppose because of timer component). That is the
>> difference. Example in documentation is InOut (I think so).
>> 
>> As I said before, I am expecting behavior similar to http component.
>> 
>> Please help.
>> 
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> You need to use the sync=true option for the mina component to instruct
>>> it
>>> to be in synchronous mode and wait for a response.
>>> 
>>> See the mina documentation and read about this option.
>>> http://activemq.apache.org/camel/mina.html
>>> 
>>> You use-case is documented there with a sample using textline and
>>> sync=true.
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 22. august 2008 13:51
>>> To: camel-user@activemq.apache.org
>>> Subject: mina tcp client problem
>>> 
>>> 
>>> Hi,
>>> 
>>> I would like to make route that will send text line to remote tcp
>>> host:port,
>>> read response and proceed with that response in body further in route. I
>>> have already make something similar with 
>>> 
>>> I tried with following route:
>>> 
>>> from("timer://whcTimer?period=20000&delay=10000")
>>> .setBody(constant("0001134765 C 65405818"))
>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>> .to("seda:whcLog")
>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>> .processRef("systemOutProcessor")
>>> .processRef("debugProcessor").to("seda:whcLog");
>>> 
>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>> 
>>> The log output is:
>>> 
>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>> Entered SystemOutProcessor.
>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>> Subscriber record was not created: subscriber already exists
>>> 
>>> From the log you can see that mina does tcp send and receive data. But,
>>> after mina the in message body is same as before. 
>>> 
>>> How to access response from remote server?
>>> As I said, I expected behavior like in http component. I have tried with
>>> sync = "true" with no success.
>>> 
>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
>>> SP1
>>> 
>>> Thanks in advance
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
Thanks for quick fix. 

I have another problem with mina component.
There is no headers in message after mina component. Is it intentional or
not (Because of InOut MEP)?

With your fix, that problem will not appear. Here is snippet of code (after
fix) from MinaProducer class

if (ExchangeHelper.isOutCapable(exchange)) {
    MinaPayloadHelper.setOut(exchange, handler.getMessage());
} else {
    MinaPayloadHelper.setIn(exchange, handler.getMessage());
}
In case of setting out message, only body is set.
In case of setting in message all headers are preserved.

Is there workaround in Camel 1.4 for this problem or I should switch to
Camel 1.5?
Maybe I should try to copy In message to Out message in custom processor
before mina? Is it good approach?

Thanks in advance




Claus Ibsen wrote:
> 
> Hi
> 
> I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus
> support your use-case out-of-the-box in Camel 1.5. So at that time you
> don't need to change the MEP from InOnly to InOut to get the response from
> mina.
> 
> Also the sync option is now default = true. 99% will call a remote socket
> server and wait for a response. 
> 
> CAMEL-847 was the ticket for this change.
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 25. august 2008 13:08
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> It works now. Thanks a lot. What is purpose of ExchangePattern if it can
> be
> changed in any moment?
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Ah you must change the exchange pattern to InOut before you send it to
>> Mina so it can set the response on the out message body.
>> 
>> I guess we might need some smarter exchange pattern in Camel. Something
>> to
>> improve in Camel 2.0!!!
>> 
>> You can change the exchange pattern in Camel in your processor code (eg.
>> debugProcessor) by casting the exchange to DefaultExchange and call the
>> setExchangePattern(InOut) to change it from InOnly to InOut
>> 
>> I guess you have a bad combination in Camel that hasn't an elegant and
>> beautiful solution. 
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 25. august 2008 12:14
>> To: camel-user@activemq.apache.org
>> Subject: RE: mina tcp client problem
>> 
>> 
>> I still need help regarding this problem.
>> 
>> I have already tried with sync option, with no results.
>> 
>> Here is my last route configuration:
>> 
>> from("timer://whcTimer?period=20000&delay=10000")
>> .setBody(constant("0001134765 C 65405818"))
>> .processRef("debugProcessor").to("seda:whcLog")
>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
>> .processRef("debugProcessor")
>> .to("seda:whcLog");
>> 
>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>> 
>> I have switch on tracing and output is following:
>> 
>> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> interceptor1
>> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
>> Expression[null]]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>> debugProcessor]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
>> debugProcessor]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]],
>> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
>> Properties:{org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:Message: null
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
>> InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to2
>> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
>> InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to4
>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
>> 0001134765
>> C 65405818
>> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
>> debugProcessor] InOnly Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000,
>> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> interceptor2
>> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
>> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
>> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
>> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
>> ID-drasko/3530-1219658769328/2-0 -> to4
>> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
>> Properties:{CamelCauseException=null,
>> org.apache.camel.timer.name=whcTimer,
>> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
>> Headers:{} Body:0001134765 C 65405818
>> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00   14765 
>> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
>> 14765 
>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>> Subscriber record was not created: subscriber already exists
>> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
>> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
>> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
>> subscriber already exists
>> 
>> As you can see, remote server is contacted and correct response is
>> received,
>> but that response is not in message body after mina component.
>> The message is InOnly (I suppose because of timer component). That is the
>> difference. Example in documentation is InOut (I think so).
>> 
>> As I said before, I am expecting behavior similar to http component.
>> 
>> Please help.
>> 
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> You need to use the sync=true option for the mina component to instruct
>>> it
>>> to be in synchronous mode and wait for a response.
>>> 
>>> See the mina documentation and read about this option.
>>> http://activemq.apache.org/camel/mina.html
>>> 
>>> You use-case is documented there with a sample using textline and
>>> sync=true.
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>>> Sent: 22. august 2008 13:51
>>> To: camel-user@activemq.apache.org
>>> Subject: mina tcp client problem
>>> 
>>> 
>>> Hi,
>>> 
>>> I would like to make route that will send text line to remote tcp
>>> host:port,
>>> read response and proceed with that response in body further in route. I
>>> have already make something similar with 
>>> 
>>> I tried with following route:
>>> 
>>> from("timer://whcTimer?period=20000&delay=10000")
>>> .setBody(constant("0001134765 C 65405818"))
>>> .processRef("systemOutProcessor").processRef("debugProcessor")
>>> .to("seda:whcLog")
>>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>>> .processRef("systemOutProcessor")
>>> .processRef("debugProcessor").to("seda:whcLog");
>>> 
>>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>>> 
>>> The log output is:
>>> 
>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>>> Entered SystemOutProcessor.
>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765
>>> C
>>> 65405818
>>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000]
>>> DEBUG
>>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>>> 65405818
>>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73 
>>> -
>>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>>> Subscriber record was not created: subscriber already exists
>>> 
>>> From the log you can see that mina does tcp send and receive data. But,
>>> after mina the in message body is same as before. 
>>> 
>>> How to access response from remote server?
>>> As I said, I expected behavior like in http component. I have tried with
>>> sync = "true" with no success.
>>> 
>>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
>>> SP1
>>> 
>>> Thanks in advance
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19156617.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

I have fixed camel-mina to be exchange pattern (MEP) agnostic and thus support your use-case out-of-the-box in Camel 1.5. So at that time you don't need to change the MEP from InOnly to InOut to get the response from mina.

Also the sync option is now default = true. 99% will call a remote socket server and wait for a response. 

CAMEL-847 was the ticket for this change.

Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 25. august 2008 13:08
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


It works now. Thanks a lot. What is purpose of ExchangePattern if it can be
changed in any moment?


Claus Ibsen wrote:
> 
> Hi
> 
> Ah you must change the exchange pattern to InOut before you send it to
> Mina so it can set the response on the out message body.
> 
> I guess we might need some smarter exchange pattern in Camel. Something to
> improve in Camel 2.0!!!
> 
> You can change the exchange pattern in Camel in your processor code (eg.
> debugProcessor) by casting the exchange to DefaultExchange and call the
> setExchangePattern(InOut) to change it from InOnly to InOut
> 
> I guess you have a bad combination in Camel that hasn't an elegant and
> beautiful solution. 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 25. august 2008 12:14
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I still need help regarding this problem.
> 
> I have already tried with sync option, with no results.
> 
> Here is my last route configuration:
> 
> from("timer://whcTimer?period=20000&delay=10000")
> .setBody(constant("0001134765 C 65405818"))
> .processRef("debugProcessor").to("seda:whcLog")
> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
> .processRef("debugProcessor")
> .to("seda:whcLog");
> 
> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
> 
> I have switch on tracing and output is following:
> 
> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor1
> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
> Expression[null]]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
> debugProcessor]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
> debugProcessor]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
> Properties:{org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:Message: null
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
> InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
> debugProcessor] InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to2
> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
> InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor2
> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to4
> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
> 0001134765
> C 65405818
> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
> debugProcessor] InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor2
> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to4
> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00   14765 
> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
> 14765 
> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
> Subscriber record was not created: subscriber already exists
> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
> subscriber already exists
> 
> As you can see, remote server is contacted and correct response is
> received,
> but that response is not in message body after mina component.
> The message is InOnly (I suppose because of timer component). That is the
> difference. Example in documentation is InOut (I think so).
> 
> As I said before, I am expecting behavior similar to http component.
> 
> Please help.
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> You need to use the sync=true option for the mina component to instruct
>> it
>> to be in synchronous mode and wait for a response.
>> 
>> See the mina documentation and read about this option.
>> http://activemq.apache.org/camel/mina.html
>> 
>> You use-case is documented there with a sample using textline and
>> sync=true.
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 22. august 2008 13:51
>> To: camel-user@activemq.apache.org
>> Subject: mina tcp client problem
>> 
>> 
>> Hi,
>> 
>> I would like to make route that will send text line to remote tcp
>> host:port,
>> read response and proceed with that response in body further in route. I
>> have already make something similar with 
>> 
>> I tried with following route:
>> 
>> from("timer://whcTimer?period=20000&delay=10000")
>> .setBody(constant("0001134765 C 65405818"))
>> .processRef("systemOutProcessor").processRef("debugProcessor")
>> .to("seda:whcLog")
>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>> .processRef("systemOutProcessor")
>> .processRef("debugProcessor").to("seda:whcLog");
>> 
>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>> 
>> The log output is:
>> 
>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>> Entered SystemOutProcessor.
>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>> Subscriber record was not created: subscriber already exists
>> 
>> From the log you can see that mina does tcp send and receive data. But,
>> after mina the in message body is same as before. 
>> 
>> How to access response from remote server?
>> As I said, I expected behavior like in http component. I have tried with
>> sync = "true" with no success.
>> 
>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
>> SP1
>> 
>> Thanks in advance
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
As I understand it message exchange patterns (MEP for short) is needed by JBI containers such as ServiceMix and thus was introduced in Camel. Please correct me.

Unfortunately Camel isn't strict about how the endpoint is configured vs. the MEP the exchange has that arrives on the endpoint. So you can have situations as yours with an InOut passing through Mina where you want an InOut.

I personally think this need to be sorted/fixed in Camel 2.0 where we should find a better solution for this. There have been some initial discussions.

Your route is however InOnly all the way. Its triggered by a timer that involves many steps for finally to end in seda:whLog.

However in the MINA step you need to get a response from a remote server and set on the in message. This is currently not supported out-of-the-box, so you have to change it from InOnly to InOut. Camel should have been smarter and just grab the response from MINA and set on IN. I have created CAMEL-847 to track this. 


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 25. august 2008 13:08
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


It works now. Thanks a lot. What is purpose of ExchangePattern if it can be
changed in any moment?


Claus Ibsen wrote:
> 
> Hi
> 
> Ah you must change the exchange pattern to InOut before you send it to
> Mina so it can set the response on the out message body.
> 
> I guess we might need some smarter exchange pattern in Camel. Something to
> improve in Camel 2.0!!!
> 
> You can change the exchange pattern in Camel in your processor code (eg.
> debugProcessor) by casting the exchange to DefaultExchange and call the
> setExchangePattern(InOut) to change it from InOnly to InOut
> 
> I guess you have a bad combination in Camel that hasn't an elegant and
> beautiful solution. 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 25. august 2008 12:14
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I still need help regarding this problem.
> 
> I have already tried with sync option, with no results.
> 
> Here is my last route configuration:
> 
> from("timer://whcTimer?period=20000&delay=10000")
> .setBody(constant("0001134765 C 65405818"))
> .processRef("debugProcessor").to("seda:whcLog")
> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
> .processRef("debugProcessor")
> .to("seda:whcLog");
> 
> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
> 
> I have switch on tracing and output is following:
> 
> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor1
> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
> Expression[null]]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
> debugProcessor]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
> debugProcessor]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
> Properties:{org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:Message: null
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
> InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
> debugProcessor] InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to2
> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
> InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor2
> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to4
> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
> 0001134765
> C 65405818
> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
> debugProcessor] InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor2
> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to4
> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00   14765 
> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
> 14765 
> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
> Subscriber record was not created: subscriber already exists
> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
> subscriber already exists
> 
> As you can see, remote server is contacted and correct response is
> received,
> but that response is not in message body after mina component.
> The message is InOnly (I suppose because of timer component). That is the
> difference. Example in documentation is InOut (I think so).
> 
> As I said before, I am expecting behavior similar to http component.
> 
> Please help.
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> You need to use the sync=true option for the mina component to instruct
>> it
>> to be in synchronous mode and wait for a response.
>> 
>> See the mina documentation and read about this option.
>> http://activemq.apache.org/camel/mina.html
>> 
>> You use-case is documented there with a sample using textline and
>> sync=true.
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 22. august 2008 13:51
>> To: camel-user@activemq.apache.org
>> Subject: mina tcp client problem
>> 
>> 
>> Hi,
>> 
>> I would like to make route that will send text line to remote tcp
>> host:port,
>> read response and proceed with that response in body further in route. I
>> have already make something similar with 
>> 
>> I tried with following route:
>> 
>> from("timer://whcTimer?period=20000&delay=10000")
>> .setBody(constant("0001134765 C 65405818"))
>> .processRef("systemOutProcessor").processRef("debugProcessor")
>> .to("seda:whcLog")
>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>> .processRef("systemOutProcessor")
>> .processRef("debugProcessor").to("seda:whcLog");
>> 
>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>> 
>> The log output is:
>> 
>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>> Entered SystemOutProcessor.
>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>> Subscriber record was not created: subscriber already exists
>> 
>> From the log you can see that mina does tcp send and receive data. But,
>> after mina the in message body is same as before. 
>> 
>> How to access response from remote server?
>> As I said, I expected behavior like in http component. I have tried with
>> sync = "true" with no success.
>> 
>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
>> SP1
>> 
>> Thanks in advance
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
It works now. Thanks a lot. What is purpose of ExchangePattern if it can be
changed in any moment?


Claus Ibsen wrote:
> 
> Hi
> 
> Ah you must change the exchange pattern to InOut before you send it to
> Mina so it can set the response on the out message body.
> 
> I guess we might need some smarter exchange pattern in Camel. Something to
> improve in Camel 2.0!!!
> 
> You can change the exchange pattern in Camel in your processor code (eg.
> debugProcessor) by casting the exchange to DefaultExchange and call the
> setExchangePattern(InOut) to change it from InOnly to InOut
> 
> I guess you have a bad combination in Camel that hasn't an elegant and
> beautiful solution. 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 25. august 2008 12:14
> To: camel-user@activemq.apache.org
> Subject: RE: mina tcp client problem
> 
> 
> I still need help regarding this problem.
> 
> I have already tried with sync option, with no results.
> 
> Here is my last route configuration:
> 
> from("timer://whcTimer?period=20000&delay=10000")
> .setBody(constant("0001134765 C 65405818"))
> .processRef("debugProcessor").to("seda:whcLog")
> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
> .processRef("debugProcessor")
> .to("seda:whcLog");
> 
> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
> 
> I have switch on tracing and output is following:
> 
> 2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor1
> Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
> Expression[null]]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
> debugProcessor]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
> debugProcessor]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]],
> DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
> Properties:{org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:Message: null
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
> InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:Message: null
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
> debugProcessor] InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to2
> To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
> InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor2
> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to4
> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
> org.apache.camel.component.mina.MinaProducer:83  - Writing body:
> 0001134765
> C 65405818
> 2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
> debugProcessor] InOnly Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
> org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> interceptor2
> Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
> RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
> RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
> org.apache.camel.processor.interceptor.TraceInterceptor:88  -
> ID-drasko/3530-1219658769328/2-0 -> to4
> To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
> Properties:{CamelCauseException=null,
> org.apache.camel.timer.name=whcTimer,
> org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
> Headers:{} Body:0001134765 C 65405818
> 2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
> 2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00   14765 
> 2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
> 14765 
> 2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
> Subscriber record was not created: subscriber already exists
> 2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
> org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
> 904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
> subscriber already exists
> 
> As you can see, remote server is contacted and correct response is
> received,
> but that response is not in message body after mina component.
> The message is InOnly (I suppose because of timer component). That is the
> difference. Example in documentation is InOut (I think so).
> 
> As I said before, I am expecting behavior similar to http component.
> 
> Please help.
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> You need to use the sync=true option for the mina component to instruct
>> it
>> to be in synchronous mode and wait for a response.
>> 
>> See the mina documentation and read about this option.
>> http://activemq.apache.org/camel/mina.html
>> 
>> You use-case is documented there with a sample using textline and
>> sync=true.
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: dkozic [mailto:drazen.kozic@asw.eu] 
>> Sent: 22. august 2008 13:51
>> To: camel-user@activemq.apache.org
>> Subject: mina tcp client problem
>> 
>> 
>> Hi,
>> 
>> I would like to make route that will send text line to remote tcp
>> host:port,
>> read response and proceed with that response in body further in route. I
>> have already make something similar with 
>> 
>> I tried with following route:
>> 
>> from("timer://whcTimer?period=20000&delay=10000")
>> .setBody(constant("0001134765 C 65405818"))
>> .processRef("systemOutProcessor").processRef("debugProcessor")
>> .to("seda:whcLog")
>> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
>> .processRef("systemOutProcessor")
>> .processRef("debugProcessor").to("seda:whcLog");
>> 
>> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
>> 
>> The log output is:
>> 
>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
>> Entered SystemOutProcessor.
>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
>> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
>> 65405818
>> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
>> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
>> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
>> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
>> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
>> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
>> Subscriber record was not created: subscriber already exists
>> 
>> From the log you can see that mina does tcp send and receive data. But,
>> after mina the in message body is same as before. 
>> 
>> How to access response from remote server?
>> As I said, I expected behavior like in http component. I have tried with
>> sync = "true" with no success.
>> 
>> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
>> SP1
>> 
>> Thanks in advance
>> -- 
>> View this message in context:
>> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141811.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Ah you must change the exchange pattern to InOut before you send it to Mina so it can set the response on the out message body.

I guess we might need some smarter exchange pattern in Camel. Something to improve in Camel 2.0!!!

You can change the exchange pattern in Camel in your processor code (eg. debugProcessor) by casting the exchange to DefaultExchange and call the setExchangePattern(InOut) to change it from InOnly to InOut

I guess you have a bad combination in Camel that hasn't an elegant and beautiful solution. 



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 25. august 2008 12:14
To: camel-user@activemq.apache.org
Subject: RE: mina tcp client problem


I still need help regarding this problem.

I have already tried with sync option, with no results.

Here is my last route configuration:

from("timer://whcTimer?period=20000&delay=10000")
.setBody(constant("0001134765 C 65405818"))
.processRef("debugProcessor").to("seda:whcLog")
.to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
.processRef("debugProcessor")
.to("seda:whcLog");

from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");

I have switch on tracing and output is following:

2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> interceptor1
Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
Expression[null]]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
debugProcessor]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
debugProcessor]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
Properties:{org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:Message: null
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:Message: null
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
debugProcessor] InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to2
To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> interceptor2
Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to4
To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
org.apache.camel.component.mina.MinaProducer:83  - Writing body: 0001134765
C 65405818
2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] WRITE: 0001134765 C 65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
debugProcessor] InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> interceptor2
Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to4
To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] SENT: 0001134765 C 65405818
2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] RECEIVED: 00   14765 
2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
14765 
2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
Subscriber record was not created: subscriber already exists
2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
subscriber already exists

As you can see, remote server is contacted and correct response is received,
but that response is not in message body after mina component.
The message is InOnly (I suppose because of timer component). That is the
difference. Example in documentation is InOut (I think so).

As I said before, I am expecting behavior similar to http component.

Please help.




Claus Ibsen wrote:
> 
> Hi
> 
> You need to use the sync=true option for the mina component to instruct it
> to be in synchronous mode and wait for a response.
> 
> See the mina documentation and read about this option.
> http://activemq.apache.org/camel/mina.html
> 
> You use-case is documented there with a sample using textline and
> sync=true.
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 22. august 2008 13:51
> To: camel-user@activemq.apache.org
> Subject: mina tcp client problem
> 
> 
> Hi,
> 
> I would like to make route that will send text line to remote tcp
> host:port,
> read response and proceed with that response in body further in route. I
> have already make something similar with 
> 
> I tried with following route:
> 
> from("timer://whcTimer?period=20000&delay=10000")
> .setBody(constant("0001134765 C 65405818"))
> .processRef("systemOutProcessor").processRef("debugProcessor")
> .to("seda:whcLog")
> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
> .processRef("systemOutProcessor")
> .processRef("debugProcessor").to("seda:whcLog");
> 
> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
> 
> The log output is:
> 
> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
> Entered SystemOutProcessor.
> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
> Subscriber record was not created: subscriber already exists
> 
> From the log you can see that mina does tcp send and receive data. But,
> after mina the in message body is same as before. 
> 
> How to access response from remote server?
> As I said, I expected behavior like in http component. I have tried with
> sync = "true" with no success.
> 
> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
> SP1
> 
> Thanks in advance
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by dkozic <dr...@asw.eu>.
I still need help regarding this problem.

I have already tried with sync option, with no results.

Here is my last route configuration:

from("timer://whcTimer?period=20000&delay=10000")
.setBody(constant("0001134765 C 65405818"))
.processRef("debugProcessor").to("seda:whcLog")
.to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true")
.processRef("debugProcessor")
.to("seda:whcLog");

from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");

I have switch on tracing and output is following:

2008-08-25 12:06:16,250 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> interceptor1
Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[SetBody[
Expression[null]]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
debugProcessor]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[Processor[ref: 
debugProcessor]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]],
DeadLetterChannel[Delegate(TraceInterceptor[To[seda:whcLog]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly
Properties:{org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:Message: null
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> setBody1 SetBody[ Expression[null]]
InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:Message: null
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> processor1 Processor[ref: 
debugProcessor] InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to1 To[seda:whcLog] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,296 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to2
To[mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true&sync=true]
InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,296 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> interceptor2
Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,312 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to4
To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,312 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-25 12:06:16,312 [timer://whcTimer?period=20000&delay=10000] DEBUG
org.apache.camel.component.mina.MinaProducer:83  - Writing body: 0001134765
C 65405818
2008-08-25 12:06:16,328 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] WRITE: 0001134765 C 65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> processor2 Processor[ref: 
debugProcessor] InOnly Properties:{CamelCauseException=null,
org.apache.camel.timer.name=whcTimer, org.apache.camel.timer.period=20000,
org.apache.camel.timer.time=null} Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-25 12:06:16,343 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to3 To[seda:whcLog] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> interceptor2
Interceptor[Delegate(DeadLetterChannel[Delegate(TraceInterceptor[To[log:asw.someLogger?level=DEBUG&showHeaders=true]]),
RecipientList[log:org.apache.camel.DeadLetterChannel?level=error],
RedeliveryPolicy[maximumRedeliveries=6]])] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [seda:whcLog thread:1] INFO 
org.apache.camel.processor.interceptor.TraceInterceptor:88  -
ID-drasko/3530-1219658769328/2-0 -> to4
To[log:asw.someLogger?level=DEBUG&showHeaders=true] InOnly
Properties:{CamelCauseException=null, org.apache.camel.timer.name=whcTimer,
org.apache.camel.timer.period=20000, org.apache.camel.timer.time=null}
Headers:{} Body:0001134765 C 65405818
2008-08-25 12:06:16,343 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-25 12:06:16,343 [AnonymousIoService-2] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] SENT: 0001134765 C 65405818
2008-08-25 12:06:16,375 [AnonymousIoService-3] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] RECEIVED: 00   14765 
2008-08-25 12:06:16,390 [AnonymousIoService-3] DEBUG
org.apache.camel.component.mina.MinaProducer:166  - Message received: 00  
14765 
2008-08-25 12:06:16,687 [AnonymousIoService-4] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
Subscriber record was not created: subscriber already exists
2008-08-25 12:06:16,687 [AnonymousIoService-4] DEBUG
org.apache.camel.component.mina.MinaProducer:166  - Message received: 00 
904765 ID: 65405818 ERROR: 300021 - Subscriber record was not created:
subscriber already exists

As you can see, remote server is contacted and correct response is received,
but that response is not in message body after mina component.
The message is InOnly (I suppose because of timer component). That is the
difference. Example in documentation is InOut (I think so).

As I said before, I am expecting behavior similar to http component.

Please help.




Claus Ibsen wrote:
> 
> Hi
> 
> You need to use the sync=true option for the mina component to instruct it
> to be in synchronous mode and wait for a response.
> 
> See the mina documentation and read about this option.
> http://activemq.apache.org/camel/mina.html
> 
> You use-case is documented there with a sample using textline and
> sync=true.
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: dkozic [mailto:drazen.kozic@asw.eu] 
> Sent: 22. august 2008 13:51
> To: camel-user@activemq.apache.org
> Subject: mina tcp client problem
> 
> 
> Hi,
> 
> I would like to make route that will send text line to remote tcp
> host:port,
> read response and proceed with that response in body further in route. I
> have already make something similar with 
> 
> I tried with following route:
> 
> from("timer://whcTimer?period=20000&delay=10000")
> .setBody(constant("0001134765 C 65405818"))
> .processRef("systemOutProcessor").processRef("debugProcessor")
> .to("seda:whcLog")
> .to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
> .processRef("systemOutProcessor")
> .processRef("debugProcessor").to("seda:whcLog");
> 
> from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");
> 
> The log output is:
> 
> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] WRITE: 0001134765 C 65405818
> Entered SystemOutProcessor.
> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
> asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
> 65405818
> 2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
> Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
> 2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] SENT: 0001134765 C 65405818
> 2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
> org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
> [/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
> Subscriber record was not created: subscriber already exists
> 
> From the log you can see that mina does tcp send and receive data. But,
> after mina the in message body is same as before. 
> 
> How to access response from remote server?
> As I said, I expected behavior like in http component. I have tried with
> sync = "true" with no success.
> 
> Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP
> SP1
> 
> Thanks in advance
> -- 
> View this message in context:
> http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19141128.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: mina tcp client problem

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

You need to use the sync=true option for the mina component to instruct it to be in synchronous mode and wait for a response.

See the mina documentation and read about this option.
http://activemq.apache.org/camel/mina.html

You use-case is documented there with a sample using textline and sync=true.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: dkozic [mailto:drazen.kozic@asw.eu] 
Sent: 22. august 2008 13:51
To: camel-user@activemq.apache.org
Subject: mina tcp client problem


Hi,

I would like to make route that will send text line to remote tcp host:port,
read response and proceed with that response in body further in route. I
have already make something similar with 

I tried with following route:

from("timer://whcTimer?period=20000&delay=10000")
.setBody(constant("0001134765 C 65405818"))
.processRef("systemOutProcessor").processRef("debugProcessor")
.to("seda:whcLog")
.to("mina:tcp://172.18.3.145:6562?textline=true&minaLogger=true")
.processRef("systemOutProcessor")
.processRef("debugProcessor").to("seda:whcLog");

from("seda:whcLog").to("log:asw.someLogger?level=DEBUG&showHeaders=true");

The log output is:

2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-22 13:32:57,640 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-22 13:32:57,640 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-22 13:32:57,656 [timer://whcTimer?period=20000&delay=10000] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] WRITE: 0001134765 C 65405818
Entered SystemOutProcessor.
2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:15  - inMessage: Message: 0001134765 C
65405818
2008-08-22 13:32:57,671 [timer://whcTimer?period=20000&delay=10000] DEBUG
asw.camel.processor.DebugProcessor:18  - inMessageBody: 0001134765 C
65405818
2008-08-22 13:32:57,671 [seda:whcLog thread:1] DEBUG asw.someLogger:73  -
Exchange[Headers:{}, BodyType:String, Body:0001134765 C 65405818]
2008-08-22 13:32:57,671 [AnonymousIoService-2] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] SENT: 0001134765 C 65405818
2008-08-22 13:32:57,718 [AnonymousIoService-3] INFO 
org.apache.camel.component.mina.MinaProducer$ResponseHandler:69  -
[/172.18.3.145:6562] RECEIVED: 00  904765 ID: 65405818 ERROR: 300021 -
Subscriber record was not created: subscriber already exists

>From the log you can see that mina does tcp send and receive data. But,
after mina the in message body is same as before. 

How to access response from remote server?
As I said, I expected behavior like in http component. I have tried with
sync = "true" with no success.

Platform: Camel 1.4, jdk1.5.0_10, Eclipse 3.3, Tomcat 5.5.17, Windows XP SP1

Thanks in advance
-- 
View this message in context: http://www.nabble.com/mina-tcp-client-problem-tp19105767s22882p19105767.html
Sent from the Camel - Users mailing list archive at Nabble.com.