Re: COBOL data parse in Camel

2015-10-08 Thread Bruce Martin
cb2xml will convert a Cobol-Copybook into Xml (with Field positions / lengths
calculated). This Xml can then parsed with Jaxb or what ever language you
choose. 

A better option would be the Data2Xml  program in  JRecord
  . This program will convert a
Cobol-Data-File to Xml. Currently it does not support  *Occurs Depending*
Supporting *Occurs Depending* would be a very minor change.



--
View this message in context: 
http://camel.465427.n5.nabble.com/COBOL-data-parse-in-Camel-tp5772356p5772446.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: SQLexception while using PreparedStatement in Camel route

2015-10-08 Thread Sashika
ORA-00942: *table or view does not exist*
Are you sure the table name "myTable" is correct and exists in your
connected schema?

On Thu, Oct 8, 2015 at 8:01 PM, bharathkmr  wrote:

> Using Camel 2.13.1 with Spring 2.7.11 and receiving an SQL exception while
> trying to run a update query using sql component.  Below is how my update
> query is added to the route and I'm passing the input parameter values to
> this the statement using a java.util.Map in the body.
>
> 
>
> 
> 
>
> 
>
> 
>
> This is the SQL exception I see all the time..
>
>  Execution of JMS message listener failed. Caused by:
> [org.apache.camel.RuntimeCamelException -
> org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback;
> bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException:
> ORA-00942: table or view does not exist
> ]: *org.apache.camel.RuntimeCamelException*:
> org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback;
> bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException:
> ORA-00942: *table or view does not exist*
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/SQLexception-while-using-PreparedStatement-in-Camel-route-tp5772433.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


JSSE Utility config for cxf/http-jetty client

2015-10-08 Thread Shultz, Dmitry
Hi All,

I'm trying to send the soap request using camel-cxf:2.10.2 and 
cxf-rt-transports-http-jetty:2.6.3. I have user name & password (using 
AuthorizationPolicy to set them) from the service provider and that's it i.e. 
can't do anything about their SSL certs.

Marshaling seems to be working, but my route is failing while trying to open 
SSL connection to the server with this message:

Caused by SSLHandshakeException: SSLHandshakeException invoking 
https://test01.someservice.com/PlaceOrder: 
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find 
valid certification path to requested target

I found JSSE Utility http://camel.apache.org/camel-configuration-utilities.html 
 and it looks like it was created to solve this kind of problem, but I'm not 
sure how to configure it... Is there any example that I can use as a reference 
or may be somebody have this done before (I'm pretty sure it was done at least 
several thousand times)

Cheers,
Dmitry



Re: Unexpected behaviour from threads async API in Camel 2.14.0

2015-10-08 Thread Antonin Stefanutti
Hi Claudius,

Using the ProducerTemplate.sendBody [1] method to send a message to the direct 
endpoint actually creates a UnitOfWorkProducer instance that blocks the caller 
thread until the unit of work has completed [2]. So even if your route contains 
some asynchronous processing through the threads DSL, the caller thread will 
block until the message is fully processed.

As your producing executor service thread pool size is equals to the task queue 
size of your consuming executor, and given the call to sendBody is synchronous, 
no rejection occurs.

[1] 
https://github.com/claudiusb/camel-threads-problem-reproducer/blob/master/src/test/java/com/github/claudiusb/camelthreadsproblemreproducer/ThreadsProblemReproducer.java#L103

[2] 
https://github.com/apache/camel/blob/camel-2.14.0/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java#L72

Antonin

> On 07 Oct 2015, at 19:35, Claudius B  wrote:
> 
> Hi Camel community,
> 
> I was trying to turn a route into asynchronous processing to cause it to
> return immediately using the threads API (http://camel.apache.org/async.html).
> When the route, more accurately the routes thread pool, cannot process more
> tasks, those should be rejected with an exception (Abort) - which is not
> happening.
> 
> The unexpected behaviour is shown and further explained in this unit test:
> https://github.com/claudiusb/camel-threads-problem-reproducer
> 
> I would be very glad if someone could take a look on this and explain to me
> what is happening, if im using the API in the wrong way or if this might be
> a problem in Camel.
> 
> Best regards
> Claudius



Trouble getting AMQP going

2015-10-08 Thread Steve Huston
I am trying to use AMQP queues as both the start and end of a route. I am 
having trouble getting this to work, following the example at 
http://camel.apache.org/amqp.html

Could someone please point me in the right direction?
Thank you,
-Steve Huston

I am deploying this in a blueprint container in karaf.

My setup is:

  

  

  

  

...


  
  
  
  
  
  
  



When I start this in karaf I get:
2015-10-08 13:34:00,968 | ERROR | nsole user karaf | BlueprintCamelContext  
  | 109 - org.apache.camel.camel-blueprint - 2.15.3 | Error occurred during 
starting Camel: CamelContext(myCamelContext) due connectionFactory must be 
specified

java.lang.IllegalArgumentException: connectionFactory must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:293)
at 
org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1131)
at 
org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(JmsConfiguration.java:485)
at 
org.apache.camel.component.jms.JmsConfiguration.createListenerConnectionFactory(JmsConfiguration.java:1140)
at 
org.apache.camel.component.jms.JmsConfiguration.getListenerConnectionFactory(JmsConfiguration.java:504)
at 
org.apache.camel.component.jms.JmsConfiguration.configureMessageListenerContainer(JmsConfiguration.java:967)
at 
org.apache.camel.component.jms.JmsConfiguration.createMessageListenerContainer(JmsConfiguration.java:448)
at 
org.apache.camel.component.jms.JmsEndpoint.createMessageListenerContainer(JmsEndpoint.java:184)
at 
org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoint.java:179)
at 
org.apache.camel.component.jms.JmsEndpoint.createConsumer(JmsEndpoint.java:71)
...




Camel delaying delivery when computer is disonnected

2015-10-08 Thread tammyABCD
Hello:

 I have three computers connected in a network. Each computer has a
queue. I am sending messages to
all of them, the routing is control by Camel. When I disconnect one of the
computers, I see a 45 seconds delay in the delivery of the message on the
computer that is still connected. Can someone give me an insight of what may
happen? 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-delaying-delivery-when-computer-is-disonnected-tp5772438.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Converting a utf-16 file

2015-10-08 Thread Jarmo Sorvari
Hi

We fetch N files via sftp.

Some of these files are large, so we use the localWorkDirectory option, to save 
jvm memory.

One of these files we have to check for a keyword to decide between success and 
failure, using

${bodyAs(String)} contains 'keyword'

which would work fine, except that this one file of all N files is utf-16.

How would I go about changing the encoding of this file? It does not matter if 
it changes permanently.

Trials with  have failed (errors about invalid xml -- 
which does not happen with iso-latin or utf-8 files) so far.

Or can I avoid conversion altogether, i.e., can I tell ${bodyAs()... that the 
contents are utf-16, when "contains" could maybe work?

Routing based on filename + data conversion bean, maybe?

I would prefer to do this with XML DSL as far as possible.

Thanks in advance!

Jarmo Sorvari
Tampere University of Applied Sciences
Finland


SQLexception while using PreparedStatement in Camel route

2015-10-08 Thread bharathkmr
Using Camel 2.13.1 with Spring 2.7.11 and receiving an SQL exception while
trying to run a update query using sql component.  Below is how my update
query is added to the route and I'm passing the input parameter values to
this the statement using a java.util.Map in the body. 










This is the SQL exception I see all the time..

 Execution of JMS message listener failed. Caused by:
[org.apache.camel.RuntimeCamelException -
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback;
bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException:
ORA-00942: table or view does not exist
]: *org.apache.camel.RuntimeCamelException*:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback;
bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException:
ORA-00942: *table or view does not exist*





--
View this message in context: 
http://camel.465427.n5.nabble.com/SQLexception-while-using-PreparedStatement-in-Camel-route-tp5772433.html
Sent from the Camel - Users mailing list archive at Nabble.com.


ConcurrentModificationException on seda consumer

2015-10-08 Thread Thibaut Robert
Hi,

I have a simple route consuming from a seda and sending to an akka Actor
(with akka-camel).
On heavy load, I got the following error:

java.util.ConcurrentModificationException: null
at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1207)
~[na:1.8.0_45-internal]
at java.util.TreeMap$EntryIterator.next(TreeMap.java:1243)
~[na:1.8.0_45-internal]
at java.util.TreeMap$EntryIterator.next(TreeMap.java:1238)
~[na:1.8.0_45-internal]
at java.util.TreeMap.buildFromSorted(TreeMap.java:2555)
~[na:1.8.0_45-internal]
at java.util.TreeMap.buildFromSorted(TreeMap.java:2504)
~[na:1.8.0_45-internal]
at java.util.TreeMap.putAll(TreeMap.java:319) ~[na:1.8.0_45-internal]
at org.apache.camel.impl.MessageSupport.copyFrom(MessageSupport.java:151)
~[camel-core-2.15.3.jar:2.15.3]
at org.apache.camel.impl.MessageSupport.copy(MessageSupport.java:124)
~[camel-core-2.15.3.jar:2.15.3]
at
org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:203)
[camel-core-2.15.3.jar:2.15.3]
at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)
[camel-core-2.15.3.jar:2.15.3]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[na:1.8.0_45-internal]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[na:1.8.0_45-internal]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45-internal]

Looking at the source of SedaConsumer, I suspect an issue with this code
(line 197-206):

// send a new copied exchange with new camel context
Exchange newExchange = prepareExchange(exchange);
// process the exchange
sendToConsumers(newExchange);
// copy the message back
if (newExchange.hasOut()) {
exchange.setOut(newExchange.getOut().copy());
} else {
exchange.setIn(newExchange.getIn());
}

sendToConsumers will not block if the route is asynchronous (which is my
case). The copy of the out message is done concurrently while the message
is processing.

Is it a bug or am i missing something ?

Thanks,
Thibaut


Re: Query

2015-10-08 Thread Antonin Stefanutti
You can do:

from("...").setHeader("CamelFileName", 
simple("${bean:java.lang.System?method=currentTimeMillis}”)).to(“hdfs://...”);

See: http://camel.apache.org/hdfs#HDFS-Produceronly

Antonin

> On 08 Oct 2015, at 15:08, ram kumar  wrote:
> 
> thanks, i am new to camel. can you point me how to give current timestamp
> as hdfs path
> 
> On Thu, Oct 8, 2015 at 5:42 PM, Claus Ibsen  wrote:
> 
>> Yeah see this FAQ
>> http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
>> 
>> But you can also set a header with the file name, then it uses that
>> and you can keep using a static to
>> http://camel.apache.org/hdfs
>> 
>> 
>> 
>> On Thu, Oct 8, 2015 at 1:46 PM, Joakim Bjørnstad 
>> wrote:
>>> Hello,
>>> 
>>> Recipient list allows dynamic endpoints:
>>> 
>>> http://camel.apache.org/recipient-list.html
>>> 
>>> 
>>> 
>>> On Thu, Oct 8, 2015 at 1:38 PM, ram kumar 
>> wrote:
 Hi,
 i would like to set the hdfs path to the current time (in millisecond),
 but CamelContext takes from conf once, is it possible to change it
 
 .to("hdfs://"+ System.currentTimeMillis() + "/")
 
 Thanks
>>> 
>>> 
>>> 
>>> --
>>> Kind regards
>>> Joakim Bjørnstad
>> 
>> 
>> 
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2nd edition:
>> https://www.manning.com/books/camel-in-action-second-edition
>> 



Re: Query

2015-10-08 Thread ram kumar
thanks, i am new to camel. can you point me how to give current timestamp
as hdfs path

On Thu, Oct 8, 2015 at 5:42 PM, Claus Ibsen  wrote:

> Yeah see this FAQ
> http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
>
> But you can also set a header with the file name, then it uses that
> and you can keep using a static to
> http://camel.apache.org/hdfs
>
>
>
> On Thu, Oct 8, 2015 at 1:46 PM, Joakim Bjørnstad 
> wrote:
> > Hello,
> >
> > Recipient list allows dynamic endpoints:
> >
> > http://camel.apache.org/recipient-list.html
> >
> >
> >
> > On Thu, Oct 8, 2015 at 1:38 PM, ram kumar 
> wrote:
> >> Hi,
> >> i would like to set the hdfs path to the current time (in millisecond),
> >> but CamelContext takes from conf once, is it possible to change it
> >>
> >> .to("hdfs://"+ System.currentTimeMillis() + "/")
> >>
> >> Thanks
> >
> >
> >
> > --
> > Kind regards
> > Joakim Bjørnstad
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition:
> https://www.manning.com/books/camel-in-action-second-edition
>


Re: Query

2015-10-08 Thread Claus Ibsen
Yeah see this FAQ
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html

But you can also set a header with the file name, then it uses that
and you can keep using a static to
http://camel.apache.org/hdfs



On Thu, Oct 8, 2015 at 1:46 PM, Joakim Bjørnstad  wrote:
> Hello,
>
> Recipient list allows dynamic endpoints:
>
> http://camel.apache.org/recipient-list.html
>
>
>
> On Thu, Oct 8, 2015 at 1:38 PM, ram kumar  wrote:
>> Hi,
>> i would like to set the hdfs path to the current time (in millisecond),
>> but CamelContext takes from conf once, is it possible to change it
>>
>> .to("hdfs://"+ System.currentTimeMillis() + "/")
>>
>> Thanks
>
>
>
> --
> Kind regards
> Joakim Bjørnstad



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Re: Query

2015-10-08 Thread Joakim Bjørnstad
Hello,

Recipient list allows dynamic endpoints:

http://camel.apache.org/recipient-list.html



On Thu, Oct 8, 2015 at 1:38 PM, ram kumar  wrote:
> Hi,
> i would like to set the hdfs path to the current time (in millisecond),
> but CamelContext takes from conf once, is it possible to change it
>
> .to("hdfs://"+ System.currentTimeMillis() + "/")
>
> Thanks



-- 
Kind regards
Joakim Bjørnstad


Query

2015-10-08 Thread ram kumar
Hi,
i would like to set the hdfs path to the current time (in millisecond),
but CamelContext takes from conf once, is it possible to change it

.to("hdfs://"+ System.currentTimeMillis() + "/")

Thanks


Re: Context Component issue

2015-10-08 Thread Antonin Stefanutti
Hi Aaron,

Great. I’ll test your patch and comment on the JIRA ticket then.

Antonin

> On 08 Oct 2015, at 07:13, Aaron Birkland  wrote:
> 
> I've opened up an issue and attached a pach to it:
> https://issues.apache.org/jira/browse/CAMEL-9200
> 
> I'm not entirely familiar with the Camel code, but this patch addresses
> everything that seemed obviously problematic to me.
> 
> Thanks,
>  Aaron
> 
> On Wed, Oct 7, 2015 at 12:48 PM, astefanutti  wrote:
> 
>> Hi Aaron,
>> 
>> I've been able to reproduce your issue and your analysis is correct.
>> 
>> The Endpoint returned by the context component has its reference to its
>> original black-box Camel context overwritten when the 'parent' context adds
>> it to its list of service. There is a clear design issue not only from the
>> address space but for the lifecycle of the endpoint as well.
>> 
>> You can create a JIRA ticket and I'll review / test your patch.
>> 
>> Antonin
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Context-Component-issue-tp5770975p5772383.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 



Attachment filename encoding issue

2015-10-08 Thread creekmind
Hello, 

I use SMTP component and I have problem with cyrillic filename for
attachment.

The issue is like https://issues.apache.org/jira/browse/CAMEL-4007, but I
have cyrillic  characters, not german Umlaut characters at the attachment
file name. According to it, I changed filename to
"\u041f\u0440\u0438\u0432\u0435\u0442", but still name is wrong, something
like this - "@825B". I used the test attached to JIRA thread and with german
umlaut character everything is fine, by cyrillic not working. 

I thought I need to change Content-Disposition header, but I didn't get how
to reach it from DataHandler.

...
Message in = exchange.getIn();
data = Base64.decodeBase64(data);
in.addAttachment("\u041f\u0440\u0438\u0432\u0435\u0442", new
DataHandler(data, "application/vnd.ms-excel"));
...



--
View this message in context: 
http://camel.465427.n5.nabble.com/Attachment-filename-encoding-issue-tp5772410.html
Sent from the Camel - Users mailing list archive at Nabble.com.