Re: Apache Mina getting response from remote tcp server

2014-10-10 Thread jkab016
Thanks for your reply. Ideally I realized the code works. The issue is that
the server expects more than one exchanges-one to open up the port. So if I
fire two messages, I am able to get the right response. the trick is to send
two messages in a loop; the first message being a fake message and then the
actual message in the second instance



-
sontranosa porahale iyanda gabba
--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Mina-getting-response-from-remote-tcp-server-tp5757409p5757459.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Http bridgeEndpoint to proxy a distant server

2014-10-10 Thread Charles Moulliard
Hi Antoine,

There is TypeConvertion issue :

DEBUG DefaultTypeConverter
- Promoting fallback type converter as a known type converter to convert
from: org.apache.camel.component.http.HttpMethods to: java.lang.String for
the fallback converter:
org.apache.camel.impl.converter.EnumTypeConverter@809a88

This is what you have to fix. More info about TypeConverter here :
http://camel.apache.org/type-converter.html

Regards,


On Thu, Oct 9, 2014 at 3:44 PM, antb59 ant...@gmail.com wrote:

 Hello,

 I'm trying to build some kind of Rest proxy with Camel :
  1 - A restlet endpoint will receive POST request with JSON body
  2 - The body will be transformed into a XML request using freemarker
  3 - The xml request will be sent to a distant HTTP server
  4 - The HTTP server will send a XML response in a synchronous way
  5 - The response will be transformed in JSON using freemarker
  6 - The JSON response will be forwarded to the client

 Steps 1 to 4 works well, without a line of code !
 But I'm facing some troubles with steps 4 : the HTTP distant server answer
 is an InputStream, and I'm not able to transform it.

 Here is my context configuration :

 bean id=RestletComponent class=org.restlet.Component /

 bean id=RestletComponentService
 class=org.apache.camel.component.restlet.RestletComponent
 constructor-arg index=0
 ref bean=RestletComponent /
 /constructor-arg
 /bean

 camelContext xmlns=http://camel.apache.org/schema/spring;
 trace=true

 route id=RS_RestletDemo
 from
 uri=restlet:/identification?restletMethod=POST /
 transform
 simple${bodyAs(String)}/simple
 /transform
 to uri=freemarker:identification.xml/
 setHeader headerName=CamelHttpMethod
 constantPOST/constant
 /setHeader
 to uri=
 http://distantserver:8012/test/identification.xml; /
 convertBodyTo type=java.lang.String/
 /route
 /camelContext


 This configuration works (steps 5-6 are not present).
 However if I add lines below convertBodyTo, the request to the restlet
 server hangs and never answer :

 route id=RS_RestletDemo
 from uri=restlet:/identification?restletMethod=POST /
 transform
 simple${bodyAs(String)}/simple
 /transform
 to uri=freemarker:identification.xml/
 setHeader headerName=CamelHttpMethod
 constantPOST/constant
 /setHeader
 to uri=http://distantserver:8012/test/identification.xml; /
 convertBodyTo type=java.lang.String/
 marshal ref=xmljsonWithOptions/
 /route

 When I check the logs, the JSON conversion seems to work fine.
 I checked samples about http proxy in camel there :

 http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html

 http://blog.sedona.fr/2013/03/introduction-aux-eips-suite-mise-en-pratique-avec-apache-camel/

 But I can't found a sample where the message out of the distant server is
 used and converted before returning to client.

 Is it possible ?

 Here are the logs when request is hanging and never returned :

 2014-10-09 15:16:09,319 [bio-8080-exec-3] DEBUG MethodBasedRouter
 - MethodRouter (/identification) received request method: POST
 2014-10-09 15:16:09,319 [bio-8080-exec-3] DEBUG RestletConsumer
 - Consumer restlet handle request method: POST
 2014-10-09 15:16:09,324 [bio-8080-exec-3] DEBUG DefaultRestletBinding
 - Populate exchange from Restlet request header: org.restlet.http.version
 value: 1.1
 2014-10-09 15:16:09,324 [bio-8080-exec-3] DEBUG DefaultRestletBinding
 - Populate exchange from Restlet request header: org.restlet.http.headers
 value: [[host: localhost:8080], [connection: keep-alive], [content-length:
 77], [cache-control: no-cache], [origin:
 chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop], [content-type:
 application/json], [user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36],
 [postman-token: eb6c491c-b940-05a2-4409-47fbf6139644], [accept: */*],
 [accept-encoding: gzip,deflate], [accept-language:
 fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4], [cookie:
 JSESSIONID=099AEDE2231A37E97E62E92986FE7481.9DFE950A9AAAD24F9A]]
 2014-10-09 15:16:09,324 [bio-8080-exec-3] DEBUG DefaultRestletBinding
 - Populate exchange from Restlet request header: org.restlet.startTime
 value: 1412860569318
 2014-10-09 15:16:09,347 [bio-8080-exec-3] INFO  Tracer
 - ID-L82680-58528-1412860563831-0-2  (RS_RestletDemo)
 from(/identification?restletMethods=POST) -- transform[Simple:
 ${bodyAs(String)}]  Pattern:InOut, Headers:{CamelRestletRequest=POST
 http://localhost:8080/wfs-rest/api/identification HTTP/1.1,
 

RE: JSch connection issue with Maverick SSHD server

2014-10-10 Thread Baweja, Keshav

Hello 

I am using Camel routing library to set up sftp routes to a remote sftp server. 
Camel user Jsch library (version 0.1.50) for all sftp operations and jsch-zlib 
(version 1.1.3) for the compression. However I encounter the exception below 
with this set up. Could someone advise/point to a resolution? Many thanks in 
advance.

[2014-10-07 10:37:11.937] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] DEBUG 
org.apache.camel.component.file.remote.SftpOperations - Using private keyfile: 
/home/localuser/.ssh/id_rsa
[2014-10-07 10:37:11.937] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] DEBUG 
org.apache.camel.component.file.remote.SftpOperations - Using knownhosts file: 
/home/localuser/.ssh/known_hosts
[2014-10-07 10:37:12.018] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] DEBUG 
org.apache.camel.component.file.remote.SftpOperations - Using 
StrickHostKeyChecking: no
[2014-10-07 10:37:12.018] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] DEBUG 
org.apache.camel.component.file.remote.SftpOperations - Using compression: 2
[2014-10-07 10:37:12.018] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - Connecting to 
host port port
[2014-10-07 10:37:12.150] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - Connection 
established
[2014-10-07 10:37:12.279] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - Remote version 
string: SSH-2.0-Maverick_SSHD
[2014-10-07 10:37:12.279] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - Local version 
string: SSH-2.0-JSCH-0.1.50
[2014-10-07 10:37:12.279] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - CheckCiphers: 
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
[2014-10-07 10:37:12.284] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - aes256-ctr is 
not available.
[2014-10-07 10:37:12.284] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - aes192-ctr is 
not available.
[2014-10-07 10:37:12.284] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - aes256-cbc is 
not available.
[2014-10-07 10:37:12.285] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - aes192-cbc is 
not available.
[2014-10-07 10:37:12.285] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - arcfour256 is 
not available.
[2014-10-07 10:37:12.285] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - CheckKexes: 
diffie-hellman-group14-sha1
[2014-10-07 10:37:12.308] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - SSH_MSG_KEXINIT 
sent
[2014-10-07 10:37:12.308] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - SSH_MSG_KEXINIT 
received
[2014-10-07 10:37:12.308] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - kex: server: 
diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
[2014-10-07 10:37:12.308] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - kex: server: 
ssh-rsa
[2014-10-07 10:37:12.308] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - kex: server: 
aes128-cbc,aes256-cbc,aes192-cbc,3des-cbc,twofish256-cbc,twofish192-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc
[2014-10-07 10:37:12.309] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - kex: server: 
aes128-cbc,aes256-cbc,aes192-cbc,3des-cbc,twofish256-cbc,twofish192-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc
[2014-10-07 10:37:12.309] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - kex: server: 
hmac-sha1,hmac-sha1-96
[2014-10-07 10:37:12.309] [Camel (camel-1) thread #0 - 
sftp://user@host:port/data] INFO  
org.apache.camel.component.file.remote.SftpOperations - JSCH - kex: server: 
hmac-sha1,hmac-sha1-96
[2014-10-07 10:37:12.309] [Camel (camel-1) thread #0 - 

Re: Http bridgeEndpoint to proxy a distant server

2014-10-10 Thread antb59
Hello Charles,

Thanks for pointing me this error, I missed it !

So it seems that the folllowing line in my route is raising the
TypeConvertion issue.
to uri=http://distantserver:8012/test/identification.xml; / 

Could you explain to me why Camel is trying to convert an HttpMethods to a
String in my case ?

Thank you again for your support.

Regards,
Antoine.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Http-bridgeEndpoint-to-proxy-a-distant-server-tp5757448p5757462.html
Sent from the Camel - Users mailing list archive at Nabble.com.


[NOTICE] Potential memory leak issue with Oracle/SUN JVM = 1.7.0_40

2014-10-10 Thread Jean-Baptiste Onofré

Hi all,

I analysed an issue that an user faced, and I found a potential memory 
leak issue related to the JVM version in use.


Basically, I saw the problem on the following environment:
- OS: Linux RHEL 64 bits (the problem can affect any platform)
- JVM Oracle/SUN 1.7.0_25 (default Karaf settings)
- Karaf 2.3.x (the problem can affect any Karaf version)
- Camel 2.12.x (the problem can affect any Camel version)

I reproduced the problem with a simple route:

from(timer:fire?period=100).setBody(constant(Hello 
World)).log(my.logger)


I took some heapdumps (baseline) and I can see:

193309 instances of class org.apache.log4j.spi.LocationInfo
193308 instances of class org.apache.log4j.spi.LoggingEvent
193308 instances of class 
org.ops4j.pax.logging.service.internal.PaxLoggingEventImpl


and still increasing up to crash the JVM with OOM (related to .log() EIP).

I upgraded to JVM Oracle/Sun 1.7.0_67 and the problem has gone.

I suspect to be related to the following bug:
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8027456

I strongly encourage all users to upgrade to 1.7.0_67 if they use a 
version lower and equal to 1.7.0_40.


Regards
JB
--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Using XML Security Component

2014-10-10 Thread Colm O hEigeartaigh
What does cl.altiuz.reports.KeyAccesor look like? Ultimately, the
getKeySelector method of this implementation is returning null. You could
look at the test source for some examples:

https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;f=components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java;hb=HEAD

Colm.


On Thu, Oct 9, 2014 at 8:08 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:

 Hi everyone,

 I need to sign an xml using the enveloped method, but haven't been able
 to realize what to do with the needed keyAccessor parameter. I'm aware of
 default available implementation, buy haven't been able to found
 documentation and/or examples using it and how to configure it. I might me
 also capable of writing my own, but also no hints on what to do.

 The scenario is as follows: I have several PFX files with certificates
 (protected by passwords), which will be used for the XML signing process,
 and I'll have to choose amongst them using an attribute from the XML
 message to be signed. (I think I'll have to import them into a KeyStore
 perhaps).

 Can anyone provide hints on how to solve this?

 This is my endpoint declaration:

 camel:to
 uri=xmlsecurity:sign://enveloped?keyAccessor=#myKeyAccessoramp;parentLocalName=notaDebito
 /

 notaDebito is the root node of the incoming XML message, which is OK in
 this case

 I also had a bean like this, but it was of no use (probably need more
 initialization that just the default:

 bean id=myKeyAccessor class=cl.altiuz.reports.KeyAccesor /

 As it shows this stacktrace:

 org.apache.camel.component.xmlsecurity.api.XmlSignatureException:
 javax.xml.crypto.dsig.XMLSignatureException: the keySelector did not find a
 signing key
 at
 org.apache.camel.component.xmlsecurity.processor.XmlSignerProcessor.sign(XmlSignerProcessor.java:307)
 at
 org.apache.camel.component.xmlsecurity.processor.XmlSignerProcessor.process(XmlSignerProcessor.java:217)
 at
 org.apache.camel.component.xmlsecurity.XmlSignatureProducer.process(XmlSignatureProducer.java:39)
 at
 org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)


 Regards,
 Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
 gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com






-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com


Camel exec component and return codes from Windows batch files

2014-10-10 Thread Chris Melikian
Hi,

I'm trying to execute a .cmd batch file in Camel 2.13.1 on Windows.

My endpoint looks like this:-

from(direct:start)
.to(exec:c:\\batch-commands\\YIELDCurves.cmd?workingDir=c:\\batch-commands\\YIELDCurves.cmd)
.log(Exit code for cli execution was [${body.exitValue}]);

and I get the exitValue of 0 from the ExecResult object in the body of IN.

Now, if I want to return from the batch file with an error code e.g. 

exit 1

I can't seem to get Camel to give me the '1' value in the log EIP statement
above.

I've tried using:-
 - to(exec:cmd?args=c:\\batch-commands...etc but that doesn't execute the
script at all and I don't get any output other than the Microsoft Command
Interpreter message for the new cmd process and return code 0
 - exit /B 1 in the batch file but that also gives return code 0 in Camel
 - exit /B [1] as I saw that usage in a DOS forum, no luck
 - exit [1] see above, no luck

I've exhausted the options I can see.

Anyone had any success with this?




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-exec-component-and-return-codes-from-Windows-batch-files-tp5757466.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Http bridgeEndpoint to proxy a distant server

2014-10-10 Thread antb59
Hello,

After checks, it seems that the trace you mentionned is not an error.

If I do a simple proxy just like in this example :
http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html

route id=Identification
from uri=restlet:/identification?restletMethod=POST /
to 
uri=http://localhost:8012/identification.xml?bridgeEndpoint=true; /
/route

The trace you mentionned is present in DEBUG. In this case the http request
is correctly processed and the restlet returns the result to the user.


The fact is I don't manage to manipulate the distant server response.

The following configuration works :

route id=Identification
from uri=restlet:/identification?restletMethod=POST /
to 
uri=http://localhost:8012/identification.xml?bridgeEndpoint=true; /
convertBodyTo type=java.lang.String/
/route

= return of restlet : 
?xml version=1.0 encoding=iso-8859-1?identificationResponse
status=0 /

The following configuration doesn't work :

route id=Identification
from uri=restlet:/identification?restletMethod=POST /
to 
uri=http://localhost:8012/identification.xml?bridgeEndpoint=true; /
convertBodyTo type=java.lang.String/
marshal ref=xmljson /
/route

= No return from restlet, the response is hanging until timeout

With the following route, the result seems to be truncated :

route id=Identification
from uri=restlet:/identification?restletMethod=POST /
to 
uri=http://localhost:8012/identification.xml?bridgeEndpoint=true; /
transform
simpleTest : ${bodyAs(String)}/simple
/transform
/route

= Return from the restlet :
Test : ?xml version=1.0 encoding=iso-8859-1?identificationResponse
statu

The end of the response seems to be truncated.

Maybe my problem is linked to InputStream return by the distant server ?
How can I solve this using only DSL ?

Regards,
Antoine.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Http-bridgeEndpoint-to-proxy-a-distant-server-tp5757448p5757474.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel-Spring, JavaConfig and Constructor-Based Injection

2014-10-10 Thread Ziemer, Tom
Hi,

currently I am setting up a new project using Spring and Camel. For a change, I 
wanted to use JavaConfig instead of the XML and had little problem injecting a 
ProducerTemplate. I am aiming for ConstructorBasedInjection, and 
@EndpointInject did not work for me.
What I ended up doing is the following:

@Configuration
@PropertySource(classpath:foo.properties)
@EnableJpaRepositories(basePackages = x.y.foo.repository)
@EnableTransactionManagement
@ComponentScan(basePackages = { x.y.foo.service, x.y.foo.camel })
public class ApplicationContext extends CamelConfiguration {


@Bean(destroyMethod = stop)
public ProducerTemplate producerTemplate() throws Exception{
return camelContext().createProducerTemplate();
}
...
}

This way I can use @Autowired to inject a producerTemplate:

@Service
public class FooServiceImpl implements FooService {
private final ProducerTemplate producerTemplate;

   @Autowired
public QuoteServiceImpl(ProducerTemplate producerTemplate) {
Assert.notNull(producerTemplate, producerTemplate must not be null.);
this.producerTemplate = producerTemplate;
}
...
}

Is this approach acceptable or is there a better way?

Regards,
Tom


Netty blueprint example

2014-10-10 Thread Mark Webb
I am working on creating an OSGI bundle that uses Netty to receive data
over a TCP connection.  I am stumped as to how and create a list of
decoders in the blueprint file.  I'm using ServiceMix 5.1.2 and I thought
I'd be able to do the following in the blueprint file :

util:list id=decoders list-class=java.util.LinkedList
ref bean=decoder1 /
ref bean=decoder2 /
/util:list

but I get XML schema errors with spring-util not being found up in
ServiceMix.  So I'm not sure if this is something I can solve with Camel,
or if this is a ServiceMix problem.  I am open to the possibility of doing
all this in a RouteBuilder class if that is a more viable solution.

Thanks for any help you can provide.


Re: Camel exec component and return codes from Windows batch files

2014-10-10 Thread Willem Jiang
camel exec is based on common-exec. 
Can you just try the your script just as the tutorial does?

[1]http://commons.apache.org/proper/commons-exec/tutorial.html
--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 10, 2014 at 6:20:21 PM, Chris Melikian (ch...@melikian.net) wrote:
 Hi,
  
 I'm trying to execute a .cmd batch file in Camel 2.13.1 on Windows.
  
 My endpoint looks like this:-
  
 from(direct:start)
 .to(exec:c:\\batch-commands\\YIELDCurves.cmd?workingDir=c:\\batch-commands\\YIELDCurves.cmd)
   
 .log(Exit code for cli execution was [${body.exitValue}]);
  
 and I get the exitValue of 0 from the ExecResult object in the body of IN.
  
 Now, if I want to return from the batch file with an error code e.g.
  
 exit 1
  
 I can't seem to get Camel to give me the '1' value in the log EIP statement
 above.
  
 I've tried using:-
 - to(exec:cmd?args=c:\\batch-commands...etc but that doesn't execute the
 script at all and I don't get any output other than the Microsoft Command
 Interpreter message for the new cmd process and return code 0
 - exit /B 1 in the batch file but that also gives return code 0 in Camel
 - exit /B [1] as I saw that usage in a DOS forum, no luck
 - exit [1] see above, no luck
  
 I've exhausted the options I can see.
  
 Anyone had any success with this?
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-exec-component-and-return-codes-from-Windows-batch-files-tp5757466.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Re: Netty blueprint example

2014-10-10 Thread Willem Jiang
I think you need to use 
list
   ref component-id=decoder1/
   ref component-id=decoder2/
/list 
to define the list object in blueprint.

You can find more information about how to define a list here[1]

[1]http://www-01.ibm.com/support/knowledgecenter/SSCKBL_8.5.5/com.ibm.websphere.osgi.nd.doc/ae/ca_blueprint_object.html
 


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 10, 2014 at 9:56:10 PM, Mark Webb (elihusma...@gmail.com) wrote:
 I am working on creating an OSGI bundle that uses Netty to receive data
 over a TCP connection. I am stumped as to how and create a list of
 decoders in the blueprint file. I'm using ServiceMix 5.1.2 and I thought
 I'd be able to do the following in the blueprint file :
  
  
  
  
  
  
 but I get XML schema errors with spring-util not being found up in
 ServiceMix. So I'm not sure if this is something I can solve with Camel,
 or if this is a ServiceMix problem. I am open to the possibility of doing
 all this in a RouteBuilder class if that is a more viable solution.
  
 Thanks for any help you can provide.
  



Expose route statistics though JMX but not allow to restart the route.

2014-10-10 Thread Amit
I would like expose the route static through JMX but not allow to restart the
route for security purpose.   



--
View this message in context: 
http://camel.465427.n5.nabble.com/Expose-route-statistics-though-JMX-but-not-allow-to-restart-the-route-tp5757488.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Http bridgeEndpoint to proxy a distant server

2014-10-10 Thread Charles Moulliard
Hi Antoine,

Add a beanProcessor (where in the code you can put a breakpoint) after the
HTTP endpoint calling your service and before the transform so you will be
able to check the objects present in the exchange.

Regards,


On Fri, Oct 10, 2014 at 1:06 PM, antb59 ant...@gmail.com wrote:

 Hello,

 After checks, it seems that the trace you mentionned is not an error.

 If I do a simple proxy just like in this example :

 http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html

 route id=Identification
 from uri=restlet:/identification?restletMethod=POST /
 to uri=
 http://localhost:8012/identification.xml?bridgeEndpoint=true; /
 /route

 The trace you mentionned is present in DEBUG. In this case the http request
 is correctly processed and the restlet returns the result to the user.


 The fact is I don't manage to manipulate the distant server response.

 The following configuration works :

 route id=Identification
 from uri=restlet:/identification?restletMethod=POST /
 to uri=
 http://localhost:8012/identification.xml?bridgeEndpoint=true; /
 convertBodyTo type=java.lang.String/
 /route

 = return of restlet :
 ?xml version=1.0 encoding=iso-8859-1?identificationResponse
 status=0 /

 The following configuration doesn't work :

 route id=Identification
 from uri=restlet:/identification?restletMethod=POST /
 to uri=
 http://localhost:8012/identification.xml?bridgeEndpoint=true; /
 convertBodyTo type=java.lang.String/
 marshal ref=xmljson /
 /route

 = No return from restlet, the response is hanging until timeout

 With the following route, the result seems to be truncated :

 route id=Identification
 from uri=restlet:/identification?restletMethod=POST /
 to uri=
 http://localhost:8012/identification.xml?bridgeEndpoint=true; /
 transform
 simpleTest : ${bodyAs(String)}/simple
 /transform
 /route

 = Return from the restlet :
 Test : ?xml version=1.0 encoding=iso-8859-1?identificationResponse
 statu

 The end of the response seems to be truncated.

 Maybe my problem is linked to InputStream return by the distant server ?
 How can I solve this using only DSL ?

 Regards,
 Antoine.




 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Http-bridgeEndpoint-to-proxy-a-distant-server-tp5757448p5757474.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io


Re: File operation failed: Broken pipe. Code: 215

2014-10-10 Thread Willem Jiang

Can you check the firewall setting of the box which cannot start the ftp 
connection?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 10, 2014 at 1:59:38 PM, kknd2015 (super...@gmail.com) wrote:
 hi,
 My route met this problem in one machine, but for the same target server, it
 can work well on the other machines.
 I can use ftp command to connect the target serer in this machine.
  
 it's my route.
  
 03 Oct 2014 08:57:45,898 WARN [CMS] [Camel (camel-1) thread #5 -
 ftp://username@1xx.198.225.111:21//Folder] Logger.warn() - Consumer
 FtpConsumer[ftp://rogerscomm@1xx.198.225.111:21//Folder?binary=trueconsumer.delay=2886delete=falsedisconnect=truefileName=%28Programs%7CSeries%7CSource%7CChannel_Lineups%7CSchedule%29_20141001.zipinitialDelay=1localWorkDirectory=tmp%2FftptmpforprovidermaximumReconnectAttempts=0noop=falsepassword=**recursive=trueseparator=UNIXthrowExceptionOnConnectFailed=true]
   
 failed polling endpoint:
 Endpoint[tp://username@1xx.198.225.111:21//Folder?binary=trueconsumer.delay=2886delete=falsedisconnect=truefileName=%28Programs%7CSeries%7CSource%7CChannel_Lineups%7CSchedule%29_20141001.zipinitialDelay=1localWorkDirectory=tmp%2FftptmpforprovidermaximumReconnectAttempts=0noop=falsepassword=**recursive=trueseparator=UNIXthrowExceptionOnConnectFailed=true].
   
 Will try again at next poll. Caused by:
 [org.apache.camel.component.file.GenericFileOperationFailedException - File  
 operation failed: Broken pipe. Code: 215]
 org.apache.camel.component.file.GenericFileOperationFailedException: File  
 operation failed: Broken pipe. Code: 215
 at
 org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:643)
 at
 org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:45)
   
 at
 org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:107)
   
 at
 org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)
   
 at
 org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
   
 at
 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)  
 at
 java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)  
 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
 at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
   
 at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:
   
  
 any suggestion, I guess it might the problem of network setting.
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/File-operation-failed-Broken-pipe-Code-215-tp5757446.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Re: Camel-Spring, JavaConfig and Constructor-Based Injection

2014-10-10 Thread Willem Jiang
You just leverage the feature which is provided by spring.
I think it’s OK to do it that way.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 10, 2014 at 8:39:03 PM, Ziemer, Tom (tom.zie...@wirecard.com) wrote:
 Hi,
  
 currently I am setting up a new project using Spring and Camel. For a change, 
 I wanted to  
 use JavaConfig instead of the XML and had little problem injecting a 
 ProducerTemplate.  
 I am aiming for ConstructorBasedInjection, and @EndpointInject did not work 
 for me.  
 What I ended up doing is the following:
  
 @Configuration
 @PropertySource(classpath:foo.properties)
 @EnableJpaRepositories(basePackages = x.y.foo.repository)
 @EnableTransactionManagement
 @ComponentScan(basePackages = { x.y.foo.service, x.y.foo.camel })
 public class ApplicationContext extends CamelConfiguration {
  
 
 @Bean(destroyMethod = stop)
 public ProducerTemplate producerTemplate() throws Exception{
 return camelContext().createProducerTemplate();
 }
 ...
 }
  
 This way I can use @Autowired to inject a producerTemplate:
  
 @Service
 public class FooServiceImpl implements FooService {
 private final ProducerTemplate producerTemplate;
  
 @Autowired
 public QuoteServiceImpl(ProducerTemplate producerTemplate) {
 Assert.notNull(producerTemplate, producerTemplate must not be null.);
 this.producerTemplate = producerTemplate;
 }
 ...
 }
  
 Is this approach acceptable or is there a better way?
  
 Regards,
 Tom
  



Re: Rest DSL with Jetty

2014-10-10 Thread Willem Jiang
FYI I already committed a patch into master and camel-2.14.x branch.
Please feel free to try the last version of 2.14.1-SNAPSHOT.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 9, 2014 at 9:52:12 AM, Willem Jiang (willem.ji...@gmail.com) wrote:
 It’s bug of camel-jetty, I just created a JIRA[1] for it.
 The hot fix is on the way.
  
 [1]https://issues.apache.org/jira/browse/CAMEL-7899
  
 --
 Willem Jiang
  
 Red Hat, Inc.
 Web: http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (English)
 http://jnn.iteye.com (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem
  
  
  
 On October 9, 2014 at 4:57:29 AM, gquintana (gerald.quint...@gmail.com) wrote:
  Hello,
 
  I am playing with the new REST DSL:
 
 
  1) The context path is not taken into account:
 
 
  2) I can't bind both post and get verbs on the same path:
 
 
  What did I miss?
 
  Gérald
 
 
 
  --
  View this message in context: 
  http://camel.465427.n5.nabble.com/Rest-DSL-with-Jetty-tp5757418.html  
  Sent from the Camel - Users mailing list archive at Nabble.com.
 
  
  



Re: restlet config doesnt work

2014-10-10 Thread Willem Jiang
Hi,

If your route cannot hold the request for enough time, your last request may 
not be blocked.

Please take a look at this question[1] in stack overflow. 
[1]http://stackoverflow.com/questions/20632706/apache-restlet-connector-overload

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 6, 2014 at 3:13:05 PM, Alexander Lvov (alexanderlv...@gmail.com) 
wrote:
 Hello dear Camel developers! I am a developer who have been using Camel and
 building routes
 for over a year. Right now we are trying to see how we should configure out
 restlet in terms of availability and perfomance and i recognised that the
 restlet settings doesnt seem to work. Here is the config for restlet we are
 experimented with:
  
  
  
  class=org.apache.camel.component.restlet.RestletComponent
  
  
  
  
  
  
  
  
 Producing over 11 requests within a minute in different threads using
 TaskExecutor does not lead to any form of rejected or timeout service. Why
 is that so? Please help!
  
 I realise its not the prettiest config to blend constructor and properties
 but it should work!
 I verified there is no overriding bean or similiar by checking bean
 settings in the route like this:
  
 ((SpringCamelContext) context).getApplicationContext().getBean(restlet)  
  
 We are using Camel 2.12 and spring 3.2.4.
  
 Sorry for typos
 BR
 Alex