camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: mina tcp client problem
Date Tue, 26 Aug 2008 05:48:28 GMT
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.


Mime
View raw message