Re: Camel Hive Issue

2016-04-05 Thread Claus Ibsen
What version of Camel do you use?

On Tue, Apr 5, 2016 at 9:13 PM, VinothKR  wrote:
> Hi,
>  I was trying to connect to hive through camel using jdbc and got
> IllegalMonitorStateException. In exchange i was able to see the data fetched
> from hive table but error was thrown when JDBCProducer tried to close the
> result set.
>
> *Logs:*
> Message History
> ---
> RouteId  ProcessorId  Processor
> Elapsed (ms)
> [uaasRoute ] [uaasRoute ] [direct://hivein
> ] [  3690]
> [uaasRoute ] [setBody1  ] [setBody[constant{select * from
> uaas_cl_poc.proactive_gcplimit}]   ] [ 0]
> [uaasRoute ] [to1   ]
> [jdbc:hive-ds?resetAutoCommit=false
> ] [  3690]
>
> Exchange
> ---
> Exchange[
>Id  ID-PHX2MYMV32-54123-1459807338148-0-2
>ExchangePattern InOut
>Headers
> {breadcrumbId=ID-PHX2MYMV32-54123-1459807338148-0-1, CamelRedelivered=false,
> CamelRedeliveryCounter=0}
>BodyTypeString
>Bodyselect * from uaas_cl_poc.proactive_gcplimit
> ]
>
> Stacktrace
> ---
> java.lang.IllegalMonitorStateException
>at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown
> Source)
>at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown
> Source)
>at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
>at
> org.apache.hive.jdbc.HiveStatement.closeClientOperation(HiveStatement.java:177)
>at
> org.apache.hive.jdbc.HiveQueryResultSet.close(HiveQueryResultSet.java:293)
>at
> org.apache.camel.component.jdbc.JdbcProducer.closeQuietly(JdbcProducer.java:246)
>at
> org.apache.camel.component.jdbc.JdbcProducer.doCreateAndExecuteSqlStatement(JdbcProducer.java:236)
>at
> org.apache.camel.component.jdbc.JdbcProducer.createAndExecuteSqlStatement(JdbcProducer.java:123)
>at
> org.apache.camel.component.jdbc.JdbcProducer.processingSqlWithoutSettingAutoCommit(JdbcProducer.java:111)
>at
> org.apache.camel.component.jdbc.JdbcProducer.process(JdbcProducer.java:67)
>
>
> Log showing data fetched from table:
> Exception in thread "main" org.apache.camel.CamelExecutionException:
> Exception occurred during execution on the exchange:
> Exchange[ID-PHX2MYMV32-54123-1459807338148-0-2][Message:
> [{proactive_gcplimit.spend=100.0, proactive_gcplimit.pd=10.0,
> proactive_gcplimit.ead=10.0, proactive_gcplimit.lgd=12345.0,
> proactive_gcplimit.obligorid=23456, proactive_gcplimit.caseid=null,
> proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.09,
> proactive_gcplimit.sic=corp, proactive_gcplimit.final_rating=null,
> proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null},
> {proactive_gcplimit.spend=90.0, proactive_gcplimit.pd=9.0,
> proactive_gcplimit.ead=9.0, proactive_gcplimit.lgd=12346.0,
> proactive_gcplimit.obligorid=23457, proactive_gcplimit.caseid=null,
> proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.01,
> proactive_gcplimit.sic=obl, proactive_gcplimit.final_rating=null,
> proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null}]]
>at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1658)
>at
> org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:646)
>at
> org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
>at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)
>at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)
>at
> org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)
>at
> aexp.uaas.camel.standalone.StandaloneTest.main(StandaloneTest.java:23)
> Caused by: java.lang.IllegalMonitorStateException
>at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown
> Source)
>
>
> 
>
> *Camel Route:*
> 
> 
> 
> select * from uaas_cl_poc.proactive_gcplimit
> 
> 
> 
> 
>
> *Hive Datasource Bean*
>
> 
>
>  class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
> 
>  value="jdbc:hive2://url" />
> 
> 
> 
>
> *Java Code:*
> CamelContext camel = SpringCamelContext.springCamelContext(appContext);
> ProducerTemplate template = camel.createProducerTemplate();
> camel.start();
> Object out = template.requestB

Re: Spring ldap configuration problem

2016-04-05 Thread Claus Ibsen
That is an old Camel version. You can try using a newer version.

On Tue, Apr 5, 2016 at 4:46 PM, rburdet  wrote:
> Camel version: 2.12.0
>
> Stacktrace:
>
> Message History
> ---
> RouteId  ProcessorId  Processor
> Elapsed (ms)
> [timerToLog] [timerToLog] [timer://timerName?period=10
> ] [10]
> [timerToLog] [setBody1  ]
> [setBody[constant{filter=(ou=mathematicians)}]
> ] [ 3]
> [timerToLog] [to1   ]
> [spring-ldap:template?operation=search
> ] [ 4]
>
> Exchange
> ---
> Exchange[
> Id  ID-localhost-localdomain-45540-1459867547898-0-2
> ExchangePattern InOnly
> Headers
> {breadcrumbId=ID-localhost-localdomain-45540-1459867547898-0-1,
> CamelRedelivered=false, CamelRedeliveryCounter=0, firedTime=Tue Apr 05
> 11:45:49 ART 2016}
> BodyTypeString
> Bodyfilter=(ou=mathematicians)
> ]
>
> Stacktrace
> ---
> java.lang.NullPointerException
> at
> org.apache.camel.component.springldap.SpringLdapProducer.process(SpringLdapProducer.java:69)
> at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:132)
> at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:307)
> at 
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:127)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
> at
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:139)
> at
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:64)
> at java.util.TimerThread.mainLoop(Timer.java:555)
> at java.util.TimerThread.run(Timer.java:505)
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Spring-ldap-configuration-problem-tp5780463p5780499.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: Camel netty is messing my TCP Hex packages

2016-04-05 Thread Claus Ibsen
Netty got some bytes decoders that are length based etc. Search a bit
on what they offer out of the box and you can configure camel netty to
use one of them.

There is also a few of them you can configure from camel-netty using
the ChannelHandlerFactories. You can find some source example at:
http://camel.apache.org/netty4.html

On Tue, Apr 5, 2016 at 4:00 PM, Felipe Gutierrez
 wrote:
> Hi,
>
> I am using camel-netty for the first time. I did an example that I can send
> string from telnet and proxy it to the third server. But now I want to
> evaluate to send pure tcp messages and I believe netty assuming to use a
> wrong decoder/encoder. Because I took out "
> &encoder=#stringEncoder&decoder=#stringDecoder" and I receive the first
> messages from the client and after while the client stop to comunicate and
> I receive the errors below. I also believe I need to create a pool of
> request as I see here (
> http://www.mastertheboss.com/jboss-frameworks/netty/use-netty-to-proxy-your-requests),
> but I do not know how to create it using Camel.
>
> In a simple way. I just want to redirect TCP messages from port 3260 to
> 3261, but Camel-Netty is converting my Hex messages to String messages. Is
> there a default en/decoder? or Hex en/decoder?
>
> Regards
>
> package org.camel.netty.first.server;
> import org.apache.camel.builder.RouteBuilder;import
> org.apache.camel.spring.Main;
> public class ServerRouter extends RouteBuilder {
>
> public static void main(String[] args) throws Exception {
> Main main = new Main();
> main.setApplicationContextUri("META-INF/spring/app-context.xml");
> main.run(args);
> }
>
> @Override
> public void configure() throws Exception {
> 
> from("netty:tcp://localhost:3260?sync=false&allowDefaultCodec=false&encoder=#stringEncoder&decoder=#stringDecoder")
>
> .to("netty:tcp://localhost:3261?sync=false&allowDefaultCodec=false&encoder=#stringEncoder&decoder=#stringDecoder");
> }}
>
>
> WARNING: Failed to release a message:
> SimpleLeakAwareByteBuf(UnpooledUnsafeDirectByteBuf(freed))
> io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
> at 
> io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:101)
> at io.netty.buffer.WrappedByteBuf.release(WrappedByteBuf.java:820)
> at 
> io.netty.buffer.SimpleLeakAwareByteBuf.release(SimpleLeakAwareByteBuf.java:34)
> at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:59)
> at 
> io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:84)
> at 
> io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:276)
> at 
> io.netty.channel.ChannelOutboundBuffer.failFlushed(ChannelOutboundBuffer.java:473)
> at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:709)
> at 
> io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:315)
> at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:676)
> at 
> io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1059)
> at 
> io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:688)
> at 
> io.netty.channel.AbstractChannelHandlerContext.access$1600(AbstractChannelHandlerContext.java:32)
> at 
> io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:992)
> at 
> io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
> at 
> io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
> at 
> io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
> at java.lang.Thread.run(Thread.java:745)
> Apr 04, 2016 2:59:15 PM io.netty.util.ReferenceCountUtil safeRelease
> WARNING: Failed to release a message: UnpooledUnsafeDirectByteBuf(freed)
> io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
> at 
> io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:101)
> at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:59)
> at 
> io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:84)
> at 
> io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:276)
> at 
> io.netty.channel.ChannelOutboundBuffer.failFlushed(ChannelOutboundBuffer.java:473)
> at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:709)
> at 
> io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:315)
> at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:676)
> at 
> io.netty.channel.DefaultChannelPipeline$Head

EIP route problem

2016-04-05 Thread slava
I have some problems with a following route:

The route

 - Receives json string an converts it to list (HashSet) of JSONObjects.
 - split the received list to json objects.
 - Set corresponding headers according to object content
 - Routes the messages according to headers to endpoint1.1 or endpoint1.2
 - Convert messages to mongodb Criteria and send to endpoint2
 - Endpoint2 routes messages according to another header to endpoint2.1 or
endpoint2.2.
 - Endpoint2.2 aggregates all received messages, processes it to get mongodb
Criteria and sends it to endpoint2.1 (completionSize is calculated at step 2
and saved in property "endpoint22").
 - Endpoint2.1 aggregates ALL messages (CamelSplitSize) converts aggregated
messages to Query object and sends it to Repository to retrieve the data.

 can see valid response object in debugger but anyway I get an error:
 - No message body writer has been found for class java.util.HashSet,
ContentType: application/json

The problem is not in response object as it works with other routes and it
does not contain HashSets.

My guess is that route sends to the output the HashSet created tat STEP 1...

The questions are:

 - what is wrong in the route output?
 - both recipientList() try to forward messages to invalid endpoint ( I have
to use .ignoreInvalidEndpoints() to avoid exception):

org.apache.camel.NoSuchEndpointException: No endpoint could be found for:
org.springframework.data.mongodb.core.query.Criteria@20f55e70, please check
your classpath contains the needed Camel component jar.


Any help would be much appreciated! Thanks.

repost:  http://stackoverflow.com/questions/36431973/apache-camel-eip-route
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/EIP-route-problem-tp5780513.html
Sent from the Camel - Users mailing list archive at Nabble.com.


EIP Route problem

2016-04-05 Thread slava
I have some problems with a following route:

The route

 - Receives json string an converts it to list (HashSet) of JSONObjects.
 - split the received list to json objects.
 - Set corresponding headers according to object content
 - Routes the messages according to headers to endpoint1.1 or endpoint1.2
 - Convert messages to mongodb Criteria and send to endpoint2
 - Endpoint2 routes messages according to another header to endpoint2.1 or
endpoint2.2.
 - Endpoint2.2 aggregates all received messages, processes it to get mongodb
Criteria and sends it to endpoint2.1 (completionSize is calculated at step 2
and saved in property "endpoint22").
 - Endpoint2.1 aggregates ALL messages (CamelSplitSize) converts aggregated
messages to Query object and sends it to Repository to retrieve the data.

 can see valid response object in debugger but anyway I get an error:
 - No message body writer has been found for class java.util.HashSet,
ContentType: application/json

The problem is not in response object as it works with other routes and it
does not contain HashSets.

My guess is that route sends to the output the HashSet created tat STEP 1...

The questions are:

 - what is wrong in the route output?
 - both recipientList() try to forward messages to invalid endpoint ( I have
to use .ignoreInvalidEndpoints() to avoid exception):

org.apache.camel.NoSuchEndpointException: No endpoint could be found for:
org.springframework.data.mongodb.core.query.Criteria@20f55e70, please check
your classpath contains the needed Camel component jar.


Any help would be much appreciated! Thanks.

repost:  http://stackoverflow.com/questions/36431973/apache-camel-eip-route
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/EIP-Route-problem-tp5780512.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Hive Issue

2016-04-05 Thread VinothKR
Hi,
 I was trying to connect to hive through camel using jdbc and got
IllegalMonitorStateException. In exchange i was able to see the data fetched
from hive table but error was thrown when JDBCProducer tried to close the
result set.

*Logs:*
Message History
---
RouteId  ProcessorId  Processor 
  
Elapsed (ms)
[uaasRoute ] [uaasRoute ] [direct://hivein  

] [  3690]
[uaasRoute ] [setBody1  ] [setBody[constant{select * from
uaas_cl_poc.proactive_gcplimit}]   ] [ 0]
[uaasRoute ] [to1   ]
[jdbc:hive-ds?resetAutoCommit=false   
] [  3690]

Exchange
---
Exchange[
   Id  ID-PHX2MYMV32-54123-1459807338148-0-2
   ExchangePattern InOut
   Headers
{breadcrumbId=ID-PHX2MYMV32-54123-1459807338148-0-1, CamelRedelivered=false,
CamelRedeliveryCounter=0}
   BodyTypeString
   Bodyselect * from uaas_cl_poc.proactive_gcplimit
]

Stacktrace
---
java.lang.IllegalMonitorStateException
   at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown
Source)
   at
java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown
Source)
   at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
   at
org.apache.hive.jdbc.HiveStatement.closeClientOperation(HiveStatement.java:177)
   at
org.apache.hive.jdbc.HiveQueryResultSet.close(HiveQueryResultSet.java:293)
   at
org.apache.camel.component.jdbc.JdbcProducer.closeQuietly(JdbcProducer.java:246)
   at
org.apache.camel.component.jdbc.JdbcProducer.doCreateAndExecuteSqlStatement(JdbcProducer.java:236)
   at
org.apache.camel.component.jdbc.JdbcProducer.createAndExecuteSqlStatement(JdbcProducer.java:123)
   at
org.apache.camel.component.jdbc.JdbcProducer.processingSqlWithoutSettingAutoCommit(JdbcProducer.java:111)
   at
org.apache.camel.component.jdbc.JdbcProducer.process(JdbcProducer.java:67)


Log showing data fetched from table:
Exception in thread "main" org.apache.camel.CamelExecutionException:
Exception occurred during execution on the exchange:
Exchange[ID-PHX2MYMV32-54123-1459807338148-0-2][Message:
[{proactive_gcplimit.spend=100.0, proactive_gcplimit.pd=10.0,
proactive_gcplimit.ead=10.0, proactive_gcplimit.lgd=12345.0,
proactive_gcplimit.obligorid=23456, proactive_gcplimit.caseid=null,
proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.09,
proactive_gcplimit.sic=corp, proactive_gcplimit.final_rating=null,
proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null},
{proactive_gcplimit.spend=90.0, proactive_gcplimit.pd=9.0,
proactive_gcplimit.ead=9.0, proactive_gcplimit.lgd=12346.0,
proactive_gcplimit.obligorid=23457, proactive_gcplimit.caseid=null,
proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.01,
proactive_gcplimit.sic=obl, proactive_gcplimit.final_rating=null,
proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null}]]
   at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1658)
   at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:646)
   at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
   at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)
   at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)
   at
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)
   at
aexp.uaas.camel.standalone.StandaloneTest.main(StandaloneTest.java:23)
Caused by: java.lang.IllegalMonitorStateException
   at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown
Source)




*Camel Route:*



select * from uaas_cl_poc.proactive_gcplimit





*Hive Datasource Bean*










*Java Code:*
CamelContext camel = SpringCamelContext.springCamelContext(appContext); 
ProducerTemplate template = camel.createProducerTemplate();
camel.start();
Object out = template.requestBody("direct:hivein","Test");
System.out.println(out);
camel.stop();

Please assist.
Thanks,
Vinoth.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Hive-Issue-tp5780522.html
Sent from the Camel - Users 

Any Camel components for Google Cloud Platform?

2016-04-05 Thread sc
 Our use case to transfer files from ftp to Google Storage, process it in
Google Big Query and copy it back to ftp.

Thanks,



--
View this message in context: 
http://camel.465427.n5.nabble.com/Any-Camel-components-for-Google-Cloud-Platform-tp5780534.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel hawtdb for aggregation

2016-04-05 Thread Vanshul . Chawla
Thanks Andreya.
Issue resolved. 

Vanshul

-Original Message-
From: Kostov, Andreya [mailto:andreya.kos...@sap.com] 
Sent: Tuesday, April 05, 2016 4:27 PM
To: users@camel.apache.org
Subject: RE: Camel hawtdb for aggregation

Hello Vanshul,

>From the POM excerpt you provided, I can see that you have specified version 
>2.3.0 for camel-hawtdb. You should use the same version for the components as 
>your camel-core version (i.e. 2.15.0), I believe that is the reason for your 
>issue.

Best regards,
Andreya

-Original Message-
From: Vanshul.Chawla [mailto:vanshul.cha...@target.com] 
Sent: Tuesday, April 05, 2016 7:55 PM
To: users@camel.apache.org
Subject: RE: Camel hawtdb for aggregation

Same issue with levelDB. If I remove the bean for levelDB and hawtDB, it works 
fine.
Camel version is 2.15.0.



camel xpath nodelist to List of String

2016-04-05 Thread rbkumar88
Hi,

Is there any quick way to convert xpath nodelist to a list of Strings.
E.g.,



123
234
..




Currently for converting the above result into a comma separated string like
(123,234 etc...), am using the pretty complex code



//Root/./ValueList


Optional obj =Optional.of(exchange.getProperty("ValueList"));

if(obj.isPresent()
&& obj.get() instanceof
com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList
&&
((com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList)obj.get()).getLength()>0){

com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList nodeList =

(com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList)obj.get();

String valueList=IntStream.range(0,
nodeList.item(0).getChildNodes().getLength()).sequential()
.mapToObj(i ->
nodeList.item(0).getChildNodes().item(i).getTextContent())
.filter(name -> name!=null && 
name.trim().length()>2)
.collect(Collectors.joining(","));
}


Regards
Bharath



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-xpath-nodelist-to-List-of-String-tp5780530.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel hawtdb for aggregation

2016-04-05 Thread Kostov, Andreya
Hello Vanshul,

>From the POM excerpt you provided, I can see that you have specified version 
>2.3.0 for camel-hawtdb. You should use the same version for the components as 
>your camel-core version (i.e. 2.15.0), I believe that is the reason for your 
>issue.

Best regards,
Andreya

-Original Message-
From: Vanshul.Chawla [mailto:vanshul.cha...@target.com] 
Sent: Tuesday, April 05, 2016 7:55 PM
To: users@camel.apache.org
Subject: RE: Camel hawtdb for aggregation

Same issue with levelDB. If I remove the bean for levelDB and hawtDB, it works 
fine.
Camel version is 2.15.0.


RE: Camel hawtdb for aggregation

2016-04-05 Thread Vanshul . Chawla
Same issue with levelDB. If I remove the bean for levelDB and hawtDB, it works 
fine.
Camel version is 2.15.0.

-Original Message-
From: Vanshul.Chawla [mailto:vanshul.cha...@target.com] 
Sent: Tuesday, April 05, 2016 10:47 AM
To: users@camel.apache.org
Subject: Camel hawtdb for aggregation

Hello all,

I am trying to use hawtdb for persistence of aggregation messages. I added the 
dependency


org.apache.camel
camel-hawtdb
2.3.0
 
 
org.fusesource.hawtdb
hawtdb
1.0
 

But when I start the jar, it gives an error message

Exception in thread "main" java.lang.NoSuchMethodError: 
org.apache.camel.util.ObjectHelper.notNull(Ljava/lang/Object;Ljava/lang/String;)V
at 
org.apache.camel.component.hawtdb.HawtDBAggregationRepository.doStart(HawtDBAggregationRepository.java:486)

Is it some dependency issue or version issue?

Vanshul


XMPP: chat responding not possible

2016-04-05 Thread Martin Scharm
Hi camels,

I tried to implement a simple XMPP bot, but reading and responding
from/to the same XMPP chat seems to fail: The bot seems to send the
messages to itself.

I configured an endpoint using:


String
userA = "bot",
userB = "human",
server = "SERVER",
port = "5222",
passwordA = "secret";

final String chatEndpoint =
  String.format("xmpp://%s@%s:%s/%s@%s?password=%s",
  userA, server, port,
  userB, server, passwordA);



which produces an endpoint such as
xmpp://bot@SERVER:5222/human@SERVER?password=secret
so the bot authenticates with SERVER and it will talk to human@SERVER.

The bot is indeed able to read from XMPP and dump the messages to std::out:


from(chatEndpoint)
.to("stream:out");


And the bot is able to send XMPP messages:


from("timer://foo?fixedRate=true&period=1000")
.setBody(constant("test"))
.to(chatEndpoint);


So far, I'm really impressed! :)

However, simply responding to the human's message fails:


from(chatEndpoint)
.to(chatEndpoint);



My XMPP server (prosody) shows me, that the bot sends the messages to
itself:


debug   Received[c2s]: 


But I have no idea why.. Am I doing something wrong?
I tried adding &participant=human@SERVER to the chatEndpoint which
doesn't solve the issue. I also tried to create two separate chat
endpoints with different resource names, but that didn't work either.

Any help is very much appreciated.

Best wishes,
Martin



signature.asc
Description: OpenPGP digital signature


Camel hawtdb for aggregation

2016-04-05 Thread Vanshul . Chawla
Hello all,

I am trying to use hawtdb for persistence of aggregation messages. I added the 
dependency


org.apache.camel
camel-hawtdb
2.3.0
 
 
org.fusesource.hawtdb
hawtdb
1.0
 

But when I start the jar, it gives an error message

Exception in thread "main" java.lang.NoSuchMethodError: 
org.apache.camel.util.ObjectHelper.notNull(Ljava/lang/Object;Ljava/lang/String;)V
at 
org.apache.camel.component.hawtdb.HawtDBAggregationRepository.doStart(HawtDBAggregationRepository.java:486)

Is it some dependency issue or version issue?

Vanshul


Re: Spring ldap configuration problem

2016-04-05 Thread rburdet
Camel version: 2.12.0

Stacktrace:

Message History
---
RouteId  ProcessorId  Processor 
  
Elapsed (ms)
[timerToLog] [timerToLog] [timer://timerName?period=10  

] [10]
[timerToLog] [setBody1  ]
[setBody[constant{filter=(ou=mathematicians)}]
] [ 3]
[timerToLog] [to1   ]
[spring-ldap:template?operation=search
] [ 4]

Exchange
---
Exchange[
Id  ID-localhost-localdomain-45540-1459867547898-0-2
ExchangePattern InOnly
Headers
{breadcrumbId=ID-localhost-localdomain-45540-1459867547898-0-1,
CamelRedelivered=false, CamelRedeliveryCounter=0, firedTime=Tue Apr 05
11:45:49 ART 2016}
BodyTypeString
Bodyfilter=(ou=mathematicians)
]

Stacktrace
---
java.lang.NullPointerException
at
org.apache.camel.component.springldap.SpringLdapProducer.process(SpringLdapProducer.java:69)
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:132)
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:307)
at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:127)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:139)
at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:64)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)





--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-ldap-configuration-problem-tp5780463p5780499.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel netty is messing my TCP Hex packages

2016-04-05 Thread Felipe Gutierrez
Hi,

I am using camel-netty for the first time. I did an example that I can send
string from telnet and proxy it to the third server. But now I want to
evaluate to send pure tcp messages and I believe netty assuming to use a
wrong decoder/encoder. Because I took out "
&encoder=#stringEncoder&decoder=#stringDecoder" and I receive the first
messages from the client and after while the client stop to comunicate and
I receive the errors below. I also believe I need to create a pool of
request as I see here (
http://www.mastertheboss.com/jboss-frameworks/netty/use-netty-to-proxy-your-requests),
but I do not know how to create it using Camel.

In a simple way. I just want to redirect TCP messages from port 3260 to
3261, but Camel-Netty is converting my Hex messages to String messages. Is
there a default en/decoder? or Hex en/decoder?

Regards

package org.camel.netty.first.server;
import org.apache.camel.builder.RouteBuilder;import
org.apache.camel.spring.Main;
public class ServerRouter extends RouteBuilder {

public static void main(String[] args) throws Exception {
Main main = new Main();
main.setApplicationContextUri("META-INF/spring/app-context.xml");
main.run(args);
}

@Override
public void configure() throws Exception {

from("netty:tcp://localhost:3260?sync=false&allowDefaultCodec=false&encoder=#stringEncoder&decoder=#stringDecoder")

.to("netty:tcp://localhost:3261?sync=false&allowDefaultCodec=false&encoder=#stringEncoder&decoder=#stringDecoder");
}}


WARNING: Failed to release a message:
SimpleLeakAwareByteBuf(UnpooledUnsafeDirectByteBuf(freed))
io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
at 
io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:101)
at io.netty.buffer.WrappedByteBuf.release(WrappedByteBuf.java:820)
at 
io.netty.buffer.SimpleLeakAwareByteBuf.release(SimpleLeakAwareByteBuf.java:34)
at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:59)
at io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:84)
at 
io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:276)
at 
io.netty.channel.ChannelOutboundBuffer.failFlushed(ChannelOutboundBuffer.java:473)
at 
io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:709)
at 
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:315)
at 
io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:676)
at 
io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1059)
at 
io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:688)
at 
io.netty.channel.AbstractChannelHandlerContext.access$1600(AbstractChannelHandlerContext.java:32)
at 
io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:992)
at 
io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
at 
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at 
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:745)
Apr 04, 2016 2:59:15 PM io.netty.util.ReferenceCountUtil safeRelease
WARNING: Failed to release a message: UnpooledUnsafeDirectByteBuf(freed)
io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
at 
io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:101)
at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:59)
at io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:84)
at 
io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:276)
at 
io.netty.channel.ChannelOutboundBuffer.failFlushed(ChannelOutboundBuffer.java:473)
at 
io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:709)
at 
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:315)
at 
io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:676)
at 
io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1059)
at 
io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:688)
at 
io.netty.channel.AbstractChannelHandlerContext.access$1600(AbstractChannelHandlerContext.java:32)
at 
io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:992)
at 
io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
at 
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(Singl

Re: Beanio stream...

2016-04-05 Thread Brad Johnson
Thanks.  I'll take a look at the custom BeanioIterator implementation.  On
the current project it's a nice to have but the next one will likely
require.  We read in 10k to 50k records which we can handle in memory.  In
the next project that will be more like 500k records (each mutli-line) and
at that point chunking makes a lot more sense.  I'd like to chunk it now if
it is easy.  I'm wondering if I could read it in with chunks of lines and
then put it through the unmarshaling.  I'll give it a test but it sounds
like I'll probably need the iterator.





  


seda:${body.class.simpleName}




On Tue, Apr 5, 2016 at 12:53 AM, mailingl...@j-b-s.de 
wrote:

> Hi Brad!
>
> To read and split a file you need a combination of streaming unmarshalling
> and splitter components. Is tmxPaymentTechIn something you wrote?
>
> You can try to read the file by camel as xml, splitting groups by xpath
> and unmarshall just the group from xml to a bean model...
>
> Unfortunately I do not use BeanIO so I do not know how the unmarshalled
> instance model looks like. Is there a List involved? If yes, it's to
> late for splitting the unmarshalled beans anyway.
>
> You can write your own processor which makes use of template-producer to
> create individual messages per group while you read the file on your own.
>
> Because you need additional header fields set I would try to write a camel
> processor to create the messages.
>
> Jens
>
> Von meinem iPhone gesendet
>
> > Am 05.04.2016 um 00:54 schrieb Brad Johnson <
> brad.john...@mediadriver.com>:
> >
> > I have a beanio mapping that's rather standard and I read it in but it
> > appears that it reads the entire file into memory instead of streaming
> it.
> > Is there a way to change that behavior so that I can take items as they
> are
> > read and put them on a queue?
> >
> >
> >
> >
> >   
> >
> > The file is an ole timey batch record with headers and mutli-line, fixed
> > width fields per record. What I'd like to see is each element header,
> > transaction, etc. read from the file and then put on the queue.  What I
> get
> > is an array of the entire file which I can, of course, split but that
> will
> > get memory intensive.
> >
> > BeanIO works very well for this as there are variable row records
> (Address
> > for example) and it snaps that stuff up well.  But I really want records
> or
> > groups to come through individually.
> >
> >
> > 
> >
> >
> > > class="foo.Header">
> > > position="0" length="1" />
> >
> >
> >
> >
> >
> >
> >
> > > maxOccurs="unbounded" class="foo.Transaction">
> >
> > > class="foo.Summary">
> > > position="0" length="1" />
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > length="1" />
> > > />
> >
> >
> > > maxOccurs="1">
> > > position="0" length="2" />
> >
> >
> > > class="foo.Addressline" minOccurs="0" maxOccurs="unbounded">
> > > position="0" length="1" />
> >
> >
> >
> >
> > > maxOccurs="1">
> > > position="0" length="1" />
> >
> >
> > > maxOccurs="1">
> > > position="0" length="1" />
> >
> >
> > > minOccurs="0" maxOccurs="1">
> > > position="0" length="3" />
> >
> >
> >
> >
>


Re: [Bug?] hl7dataformat hapicontext&parser not in camel-blueprint.xsd

2016-04-05 Thread Quinn Stevenson
I learned something new - I’ve never used the camel:dataFormats element before.

I normally do something like this





You’d have to define “my-parser” as well, but I think this will work.



> On Apr 5, 2016, at 12:03 AM, Walzer, Thomas  
> wrote:
> 
> When I write the blueprint xml I have a reference to camel-blueprint.xsd in 
> it. So that the tooling can check my xml against the xsd.
> 
> --snip from camel-blueprint.xsd ---
> 
>  
>
>  
>
>
>  
>Whether to validate the HL7 
> message Is by default true.
>  
>
>  
>
>  
> 
> --end snip 
> 
> From the docs it should be  more like
> 
> 
>
>  
>
>
>  
>Whether to validate the HL7 
> message Is by default true.
>  
>
>
>  
>The hapiContext to 
> use
>  
>
>
>  
>The parser to 
> use
>  
>
>  
>
> 
> 
> So for instance the following snippet in my blueprint
>  
>   
> 
> 
> yields:
> 
> cvc-complex-type.3.2.2: Attribute 'parser' is not allowed to appear in 
> element 'camel:hl7'.
> 
> This happens not only when validating the source but also when starting up, 
> as the blueprint gets validated again.
> 
> Cheers, Thomas.
> 
> -Ursprüngliche Nachricht-
> Von: Quinn Stevenson [mailto:qu...@pronoia-solutions.com] 
> Gesendet: Montag, 04. April 2016 17:17
> An: users@camel.apache.org
> Betreff: Re: [Bug?] hl7dataformat hapicontext&parser not in 
> camel-blueprint.xsd
> 
> As far as I know, Blueprint uses reflection to set properties so there 
> wouldn’t be any need for any changes in camel-blueprint when a 
> component/dataformat gets new properties.
> 
> What exactly is your issue?
> 
>> On Apr 4, 2016, at 2:19 AM, Walzer, Thomas  
>> wrote:
>> 
>> Hi,
>> 
>> is it possible that 
>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd does not 
>> contain the new properties hapiContext & parser?
>> Makes it hard to use the features from 2.14.1 in blueprint ;-)
>> 
>> Jira?
>> 
>> Cheers, Thomas.
> 



Re: Camel 2.17 camel-cdi injection problem

2016-04-05 Thread murt_ryan
Hi Antonin,
That answers my question perfectly, thanks very much for your time.

/marty



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-2-17-camel-cdi-injection-problem-tp5780050p5780492.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Limit swagger API

2016-04-05 Thread fabryprog
Done

https://issues.apache.org/jira/browse/CAMEL-9817



--
View this message in context: 
http://camel.465427.n5.nabble.com/Limit-swagger-API-tp5778791p5780491.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cannot write content of temp file to remote ftp

2016-04-05 Thread janvandeklok
Thnx Claus for your response.  If nesting of the .from is not allowwed I
would expect an exception to be thrown. Now the route just ends normally,
leaving the programmer is a desperate state :-).

I fixed it now. Not by using the pollEnrich but by setting the temp file in
the exchange body when the fillTempFileWithaLotOfData processor is done
writing the data to the temp file like this :


public void process(Exchange exchange) throws Exception {
try 
{
   .. lots of other code 
   //create a temp file
File myFile = new File(tmpFileUri);
BufferedWriter buffer = new BufferedWriter(new FileWriter(myFile));

// ... write lots of data to buffer 
   
buffer.close();
   * exchange.getIn().setBody(myFile);*
}
finally 
{
}
}

This seems to be working OK.

Thnx again.

Jan van de Klok



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cannot-write-content-of-temp-file-to-remote-ftp-tp5780480p5780485.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RESOILVED: Durability with dynamically created Virtual Topic consumers

2016-04-05 Thread jpeschke
Hello,
Ok, sorry - my fault.
The VirtualTopic consumption works like a charm & exactly as expected. I
just made a mistake in my route setup what caused the recipientList for the
consuming system to be empty. So the whole thing worked just fine from the
beginning, only the camel route that consumed the virtual topic didn't
dispatch the message any further *facepalm* :(.

Analyzing the "Enqueue" und "Dequeue" values within the ActiveMQ broker (via
jConsole) finally got me on the right track.

Thanks anyway!

Joerg




--
View this message in context: 
http://camel.465427.n5.nabble.com/ActiveMQ-Durability-with-dynamically-created-Virtual-Topic-consumers-tp5780446p5780484.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cannot write content of temp file to remote ftp

2016-04-05 Thread Claus Ibsen
You cannot have from in the nested route in the rest-dsl.

If you want to upload a file to a FTP server and write the file using
a temp name, then use the tempFileName or tempPrefix options. The
tempPrefix is the easiest to get started with
http://camel.apache.org/file2

And if you want to trigger the upload using rest GET call then do a

rest GET
 poll enrich file
  to ftp


On Tue, Apr 5, 2016 at 9:11 AM, janvandeklok  wrote:
> Hello, I need to create a file with lots of data  depending on a user request
> and transfer that temp file to a remote ftp.   I have everything running
> without errors and the remote file is created but the content of the created
> remote file is still 0 bytes while the temp file has lots of bytes.
> I don't understand what i'm doing wrong.
>
> Here's the essence of my code:
>
>
>
> public class MYRoute extends AbstractRoute {
>
> public void configure() throws Exception
> {
> super.configure();
>
>
>  File temp = File.createTempFile("mytempfile.json");
>
>  String uriOut = "sftp://"+ System.getenv("my_sftp_host")+
> "/INCOMMING?"
> + "eagerDeleteTargetFile=false&"
> + "exchangePattern=OutOnly&"
> + "allowNullBody=true&"
> + "fileName=my_gen_inf.json&"
> + "password="+ System.getenv("my_sftp_password")+ "&"
> + "username="+ System.getenv("my_sftp_username")+ "&"
> + "timeout=6&"
> + "useList=false";
>
>
> rest("some url")
> .get("/generic").produces(MIME_MEDIA_TYPE_JSON)
> .route()
> .routeId("MY_generic_interface")
> .process(new fillTempFileWithaLotOfData(temp.toURI()))
> .from(temp.toURI().toString())
> .to(uriOut)
> .setBody(constant("{ 'result': 'OK'}"));
>   }
>
>
> Any help is appreciated.
>
> Jan van de Klok
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Cannot-write-content-of-temp-file-to-remote-ftp-tp5780480.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Cannot write content of temp file to remote ftp

2016-04-05 Thread janvandeklok
Hello, I need to create a file with lots of data  depending on a user request
and transfer that temp file to a remote ftp.   I have everything running
without errors and the remote file is created but the content of the created
remote file is still 0 bytes while the temp file has lots of bytes. 
I don't understand what i'm doing wrong.

Here's the essence of my code:



public class MYRoute extends AbstractRoute {

public void configure() throws Exception 
{
super.configure();


 File temp = File.createTempFile("mytempfile.json"); 

 String uriOut = "sftp://"+ System.getenv("my_sftp_host")+
"/INCOMMING?"
+ "eagerDeleteTargetFile=false&"
+ "exchangePattern=OutOnly&"
+ "allowNullBody=true&"
+ "fileName=my_gen_inf.json&"
+ "password="+ System.getenv("my_sftp_password")+ "&"
+ "username="+ System.getenv("my_sftp_username")+ "&"
+ "timeout=6&"
+ "useList=false"; 


rest("some url")
.get("/generic").produces(MIME_MEDIA_TYPE_JSON)
.route()
.routeId("MY_generic_interface")
.process(new fillTempFileWithaLotOfData(temp.toURI()))
.from(temp.toURI().toString())
.to(uriOut)
.setBody(constant("{ 'result': 'OK'}"));
  } 


Any help is appreciated.

Jan van de Klok



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cannot-write-content-of-temp-file-to-remote-ftp-tp5780480.html
Sent from the Camel - Users mailing list archive at Nabble.com.