Re: Can Camel sftp use sshj library?

2018-06-05 Thread Claus Ibsen
Hi

No its not possible. You would need to copy the camel-ftp source code
and change it yourself to use that other library.
And then use your custom component.

Also have you reported to JSCH about those newer chipers, maybe they
have it working on their next release.

On Wed, Jun 6, 2018 at 6:49 AM, Anu Madan  wrote:
> Hi All,
>
> I am using apache camel ftp2 for connecting to the sftp server.
> The sftp server has recently been updated to use latest ciphers and
> kex algorithms.
> These algos are not supported by the latest JSch library (version 0.1.54).
> Is there a way to configure camel to use sshj library instead of JSch
> since JSch is old and has not been updated in last 1.5 years?
> Please suggest. This is an urgent production issue and the apache
> camel application is unable to connect to the sftp server.
>
> Thanks in advance,
>
> Anu



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Can Camel sftp use sshj library?

2018-06-05 Thread Anu Madan
Hi All,

I am using apache camel ftp2 for connecting to the sftp server.
The sftp server has recently been updated to use latest ciphers and
kex algorithms.
These algos are not supported by the latest JSch library (version 0.1.54).
Is there a way to configure camel to use sshj library instead of JSch
since JSch is old and has not been updated in last 1.5 years?
Please suggest. This is an urgent production issue and the apache
camel application is unable to connect to the sftp server.

Thanks in advance,

Anu


Re: host not found when using http4 in docker container

2018-06-05 Thread Willem Jiang
Can  you add a link  to the camel container just like this ?

camel:
image: "camel:0.3.0-SNAPSHOT"
hostname: camel
links:
- "otherHost"
- "zipkin:zipkin.io"


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Wed, Jun 6, 2018 at 4:40 AM, Tim Dudgeon  wrote:

> On 05/06/18 20:40, Robin Vanderhallen wrote:
>
>> Are both containers in the same network in the docker compose file?
>>
> Yes. Both are in the same network environment, but this is not the default
> network.
>
> networks:
> - xxx
>
> Tim
>


Re: host not found when using http4 in docker container

2018-06-05 Thread Tim Dudgeon

On 05/06/18 20:40, Robin Vanderhallen wrote:

Are both containers in the same network in the docker compose file?
Yes. Both are in the same network environment, but this is not the 
default network.


    networks:
    - xxx

Tim


Re: host not found when using http4 in docker container

2018-06-05 Thread Robin Vanderhallen
Are both containers in the same network in the docker compose file?
On 5 Jun 2018, 19:29 +0200, Tim Dudgeon , wrote:
> I'm running camel inside a Docker container and trying to use the HTTP4
> component to post a request to a service running in a different
> container (both containers are managed through Docker compose).
> Essentially I'm trying to do a post to a route like this:
> http4:coreservices:8080/coreservices/rest/v1/services
> where coreservices is the name of the other container.
>
> This fails with a  java.net.UnknownHostException (see below).
> But the other container is definitely accessible from this container as
> if I open a shell in it I can the curl the 'coreservices' host.
>
> Any idea what's going wrong here?
>
> Thanks
> Tim
>
>
> 05-Jun-2018 17:09:34.667 SEVERE [localhost-startStop-1]
> org.apache.camel.util.CamelLogger.log Failed delivery for (MessageId:
> ID-4b81ce1e6383-46459-1528218572076-1-3 on ExchangeId:
> ID-4b81ce1e6383-46459-1528218572076-1-2). Exhausted after delivery
> attempt: 1 caught: java.net.UnknownHostException: coreservices: Name or
> service not known
>
> Message History
> ---
> RouteId  ProcessorId Processor Elapsed (ms)
> [route6    ] [route6    ]
> [direct://post-service-descriptors ] [   283]
> [route6    ] [log1  ] [log ] [ 5]
> [route6    ] [process1  ] [Processor@0xa8e9d5 ] [   173]
> [route6    ] [to1   ]
> [http4:coreservices:8080/coreservices/rest/v1/services ] [    95]
>
> Stacktrace
> ---
>  java.net.UnknownHostException: coreservices: Name or service not known
>     at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
>     at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
>     at
> java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
>     at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
>     at java.net.InetAddress.getAllByName(InetAddress.java:1192)
>     at java.net.InetAddress.getAllByName(InetAddress.java:1126)
>     at
> org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
>     at
> org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
>     at
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
>     at
> org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
>     at
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
>     at
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
>     at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
>     at
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
>     at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
>     at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
>     at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
>     at
> org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:306)
>     at
> org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:178)
>     at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>     at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
>     at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>     at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>     at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>     at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
>     at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>     at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>     at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>     at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>     at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
>     at
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529)
>     at
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:497)
>     at
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365)
>     at
> 

host not found when using http4 in docker container

2018-06-05 Thread Tim Dudgeon
I'm running camel inside a Docker container and trying to use the HTTP4 
component to post a request to a service running in a different 
container (both containers are managed through Docker compose).

Essentially I'm trying to do a post to a route like this:
http4:coreservices:8080/coreservices/rest/v1/services
where coreservices is the name of the other container.

This fails with a  java.net.UnknownHostException (see below).
But the other container is definitely accessible from this container as 
if I open a shell in it I can the curl the 'coreservices' host.


Any idea what's going wrong here?

Thanks
Tim


05-Jun-2018 17:09:34.667 SEVERE [localhost-startStop-1] 
org.apache.camel.util.CamelLogger.log Failed delivery for (MessageId: 
ID-4b81ce1e6383-46459-1528218572076-1-3 on ExchangeId: 
ID-4b81ce1e6383-46459-1528218572076-1-2). Exhausted after delivery 
attempt: 1 caught: java.net.UnknownHostException: coreservices: Name or 
service not known


Message History
---
RouteId  ProcessorId Processor Elapsed (ms)
[route6    ] [route6    ] 
[direct://post-service-descriptors ] [   283]

[route6    ] [log1  ] [log ] [ 5]
[route6    ] [process1  ] [Processor@0xa8e9d5 ] [   173]
[route6    ] [to1   ] 
[http4:coreservices:8080/coreservices/rest/v1/services ] [    95]


Stacktrace
---
 java.net.UnknownHostException: coreservices: Name or service not known
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at 
java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)

    at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
    at java.net.InetAddress.getAllByName(InetAddress.java:1192)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)
    at 
org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
    at 
org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
    at 
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at 
org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at 
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at 
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)

    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at 
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at 
org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:306)
    at 
org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:178)
    at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
    at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
    at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
    at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)

    at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
    at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
    at 
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
    at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
    at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
    at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529)
    at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:497)
    at 
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365)
    at 
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:497)

    at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:242)
    at 
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:148)
    at 

Re: onException - properties and headers are lost

2018-06-05 Thread Balazs Szeti
Hi Reji,

You can use useOriginalMessage()

in onException to restore the original message body you received at from().
Like this:
onException(java.net.SocketException.class)
.useOriginalMessage()
.handled(true)
...
If the original message body was a stream you should enable stream caching
 on the route
(from("...").streamCaching()) or on the Camel Context.

Also there might be another problem with your route as exchange properties
should be available within onException(). Message headers are a bit
different as the endpoints called during the route modifies them a lot, but
if you store something in an exchange property at the beginning, it should
be available in onException.

Can you share the whole route and the storeOriginalPayloadInDb processor?
Which Camel version do you use exactly?

Regards,
Balazs

On Tue, Jun 5, 2018 at 2:29 AM Reji Mathews  wrote:

> Hi guys
>
> I have a business requirement where if an api call fails, I need to store
> the payload in a database for future retry.
>
> I have an onException clause like this
>
> onException(java.net.SocketException.class)
> .handled(true)
> .maximumRedeliveries(3)
> .log("Records are dropping due to excessing number of socket
> connections created. Dropping DPCI : ${property.dpci} , TCIN :
> ${property.tcin}")
> .to("log:MYAUDIT_2?showAll=true")
> .process(storeOriginalPayloadInDb)
> .end();
>
>
> I have added a property called "originalPayload" containing the received
> data. I want it to access the property in processor "
> *storeOriginalPayloadInDb*"
>
> I get NullPointorException accessing the property "originalPayload" ,
> reason being all headers and properties of the original exchange are lost
> by the time flow comes to onException block.
>
> What is the way I can achieve my requirement?
>
> Cheers
>


onException - properties and headers are lost

2018-06-05 Thread Reji Mathews
Hi guys

I have a business requirement where if an api call fails, I need to store
the payload in a database for future retry.

I have an onException clause like this

onException(java.net.SocketException.class)
.handled(true)
.maximumRedeliveries(3)
.log("Records are dropping due to excessing number of socket
connections created. Dropping DPCI : ${property.dpci} , TCIN :
${property.tcin}")
.to("log:MYAUDIT_2?showAll=true")
.process(storeOriginalPayloadInDb)
.end();


I have added a property called "originalPayload" containing the received
data. I want it to access the property in processor "
*storeOriginalPayloadInDb*"

I get NullPointorException accessing the property "originalPayload" ,
reason being all headers and properties of the original exchange are lost
by the time flow comes to onException block.

What is the way I can achieve my requirement?

Cheers