Re: Testing a transacted route with CamelTestSupport

2013-07-17 Thread roman.stumm
When I write a unit-test or use a test-spring.xml, I can use my
DummyTransactionManager like this:

 

or programmatically:

class MyTest extends CamelTestSupport {

@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new
DefaultCamelContext(createSimpleRegistry());
return context;
}
private Registry createSimpleRegistry() {
registry = new SimpleRegistry(); 
registry.put("transactionManager", new DummyTransactionManager());
return registry;
}
}

So I can use transacted() in camel-routes, but without accessing a
JMS-TransactionManager or any DataSource, just as a unit-test...

Here is the class:
public class DummyTransactionManager implements PlatformTransactionManager {
public TransactionStatus getTransaction(TransactionDefinition
transactionDefinition)
throws TransactionException {
return new SimpleTransactionStatus();
}

public void commit(TransactionStatus transactionStatus) throws
TransactionException {
}

public void rollback(TransactionStatus transactionStatus) throws
TransactionException {

}
}




--
View this message in context: 
http://camel.465427.n5.nabble.com/Testing-a-transacted-route-with-CamelTestSupport-tp5502129p5735768.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Turning off warning message in ObjectHelper

2013-07-17 Thread Claus Ibsen
Hi

Thanks for reporting. I have logged a ticket to get this improved/fixed
https://issues.apache.org/jira/browse/CAMEL-6553

On Sun, Jul 14, 2013 at 12:19 PM, kmonging  wrote:
> While upgrading from camel 2.10.4 to camel 2.10.5, i noticed some additional
> warning messages in the ObjectHelper class, is there anyway to turn it off?
> The value is assigned correctly, just the annoying warning message. :(
>
> Below are the snippet of the configuration and logs.
>
> 
> 
> 
>
> 
> 
> 
> 
>
> [DEBUG] o.s.b.f.s.DefaultListableBeanFactory> Returning cached instance of
> singleton bean 'testMap'
> [WARN ] o.a.c.u.ObjectHelper> Cannot find class: isMaster
>
> Thanks in advance.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Turning-off-warning-message-in-ObjectHelper-tp5735616.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Hessian support (from/to endpoints)

2013-07-17 Thread flangel
Hi,

what is the current state of hessian support. I like to use Hessian as a
"from" endpoint, i.e. start the route by exposing an http endpoint and
decoding the payload. Something along the line of from ("hessian:\\uri).

Currently, i am using an http endpoint and add a processor that decodes the
hessian wire protocol/payload.

Question:

1. Does a Hessian component that provides a consumer (From) endpoint already
exist. I could not find any source code/examples.

2. If not, and if you are experienced with Hessian, what would a good api be
for the hessian "from"  endpoint. What about from
("hessian:\\uri\?methodName=method1). This would create an endpoint
waiting for the invocation of method1 through a client. The client created a
factory connection to \\uri\ previously to invoking the method.

3. the "to" case would be rather simple
to("hessian:\\\service?methodName=method1) with the parameters in the
header 

Your feedback is appreciated
Best
Frank







--
View this message in context: 
http://camel.465427.n5.nabble.com/Hessian-support-from-to-endpoints-tp5735774.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to recover corrupted HawtDB files

2013-07-17 Thread Claus Ibsen
What version of Camel and HawtDB are you using?

To try to recover you would possible need to write some java code with
the HawtDB API to load the corrupted file(s) and peak inside.

Down the road we recommend using camel-leveldb instead of
camel-hawtdb. This uses LevelDB as the store instead which is a much
more mature and widespread used store.
https://code.google.com/p/leveldb/

Apache ActiveMQ 5.9 offers leveldb out of the box, and is being
considered as the recommended/default store over its KahaDB store.

The camel-leveldb has the same functionality as camel-hawtdb and is
very similar to setup.


On Tue, Jul 16, 2013 at 10:12 AM, Stefan Burkard  wrote:
> Hi Camel users
>
> I have a component with 2 persistent aggregators. One receives all messages,
> one only a part of them. After a lot of test runs without problems I had
> yesterday a serious problem with the aggregator persistence (hawtdb).
>
> I don't know yet what causes the problems, but however, problems can occur.
> My problem is that I cannot recover the data from the hawtdb-files.
>
> Im my logs, I got first of all about 8 stacktraces like the attached
> "stacktrace1.txt". The number in the error message "The requested page was
> not an extent: 35" is growing from stacktrace to stacktrace from 35 to 1163.
>
> Then, I got some stacktraces like the attached "stacktrace2.txt".
>
> Finally I got A LOT of stacktraces like the attached "stacktrace3.txt".
>
> After shutting down the component gracefully, I tried to restart it, but
> this throws stacktraces like the attached "stacktrace-startup.txt".
>
> I can only start the component again if I rename the hawtdb-files so they
> are ignored and new hawtdb-files are created.
>
> This leaves me with the question: how can I recover the corrupted
> hawtdb-files? I didn't found anything about this subject and if this is not
> possible, this would be a real show-stopper.
>
> Thanks for any help
> Stefan
>



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Hessian support (from/to endpoints)

2013-07-17 Thread Willem jiang
Hi,

I don't think we have the camel-hessina component, and we love contribution, 
please share the idea with us :)

I think you can take a look at the camel-xmlrpc[1] component
I just have quick question of the methodName option. What's the prepose of 
methodName? If you need to specify the methodName, you may also need to provide 
a Interface class for camel-hassina endpoint to use.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, July 17, 2013 at 3:54 PM, flangel wrote:

> Hi,
>  
> what is the current state of hessian support. I like to use Hessian as a
> "from" endpoint, i.e. start the route by exposing an http endpoint and
> decoding the payload. Something along the line of from ("hessian:\\uri).
>  
> Currently, i am using an http endpoint and add a processor that decodes the
> hessian wire protocol/payload.
>  
> Question:
>  
> 1. Does a Hessian component that provides a consumer (From) endpoint already
> exist. I could not find any source code/examples.
>  
> 2. If not, and if you are experienced with Hessian, what would a good api be
> for the hessian "from" endpoint. What about from
> ("hessian:\\uri\?methodName=method1). This would create an endpoint
> waiting for the invocation of method1 through a client. The client created a
> factory connection to \\uri\ previously to invoking the method.
>  
> 3. the "to" case would be rather simple
> to("hessian:\\\service?methodName=method1) with the parameters in the
> header  
>  
> Your feedback is appreciated
> Best
> Frank
>  
>  
>  
>  
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Hessian-support-from-to-endpoints-tp5735774.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: REST best practices

2013-07-17 Thread humayun0156
Yes, i've solved my problem. 




--
View this message in context: 
http://camel.465427.n5.nabble.com/REST-best-practices-tp5735585p5735785.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Incoming message from a JMS queue need to be processed in parallel but keep the ordering of messages

2013-07-17 Thread gquintana
Hi Raúl,

In a non XA world, how does this Unit of work concept mix with Spring's
management of transaction and resources (connections) which are bound to
thread by the TransactionSynchronizationManager?





--
View this message in context: 
http://camel.465427.n5.nabble.com/Incoming-message-from-a-JMS-queue-need-to-be-processed-in-parallel-but-keep-the-ordering-of-messages-tp5735406p5735789.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Route failure on startup for SMPP consumer if SMSC down

2013-07-17 Thread JasonN
"Would like to get some more thoughts whether we should add this feature or
not."

I would see this as a big improvement for the smpp component.

Thanks.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-failure-on-startup-for-SMPP-consumer-if-SMSC-down-tp5730666p5735799.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Run once a month Camel Bean

2013-07-17 Thread kikou1984
Ok thxs ! i found it :) 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Run-once-a-month-Camel-Bean-tp5735712p5735800.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Get the exception org.apache.camel.RuntimeCamelException: java.lang.RuntimeException: Protocol mismatch for port 443: engine's protocol is http, the url protocol is https

2013-07-17 Thread cannykanna
Hi Christian, Mueller CamelCXFProviderRouteConfig.xml

  
TesterBean.java
  

I am attaching the config xml and testerBean class. but I somehow feel,
there is no routing happening and no where camel is used. Can you check
please..?

Regards
Kannaiah




--
View this message in context: 
http://camel.465427.n5.nabble.com/Get-the-exception-org-apache-camel-RuntimeCamelException-java-lang-RuntimeException-Protocol-mismatcs-tp5735568p5735813.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Incoming message from a JMS queue need to be processed in parallel but keep the ordering of messages

2013-07-17 Thread Raul Kripalani
Hi,

Looks like I got things a bit mixed up with the Synchronization usage in
the File consumer for some reason.

You're right, Spring JMS provides the JmsTransactionManager and we leverage
that in this case instead of reinventing the wheel. So as long as the
endpoints along the route share the same ConnectionFactory and are executed
in the same thread (careful with the async routing engine), Spring takes
care of synchronizing the sends/receives.

BTW - I want to clarify. What I meant with "Seda preserving transactional
integrity" is *not* a general statement, i.e. a transaction governed by a
Transaction Manager existing on the producer side of the Seda queue
(route1) will NOT be propagated to the consumer side (route2), as they are
running in different threads. My reply was in the context of the user's
question:

Using Seda is the transnational integrity preserved?
> Let say the delivery of one message using seda fails, does camel recognize
> it and redeliver it?


If JavaSpaces on route2 throws an exception, then it can be propagated to
route1 such that the JMS transaction will roll back. But a JMS send done in
turn form route2 will not enlist itself in the existing TX.

I hope this clarifies things.

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Wed, Jul 17, 2013 at 10:40 AM, gquintana wrote:

> Hi Raúl,
>
> In a non XA world, how does this Unit of work concept mix with Spring's
> management of transaction and resources (connections) which are bound to
> thread by the TransactionSynchronizationManager?
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Incoming-message-from-a-JMS-queue-need-to-be-processed-in-parallel-but-keep-the-ordering-of-messages-tp5735406p5735789.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


File append issue for an SFTP producer

2013-07-17 Thread lumi velicanu
Hi,

I am experiencing a file append issue with a sql consumer and an sftp
producer. On the sftp producer I have fileExist=Append but instead of
appending to the file, it does an override. The problem seems to be on
the sftp side because when I test it with ftp it works correctly.

This happens for a SINGLE sql consumer poll. The sql select returns
three rows but the output file contains only the last row preceded by
a bunch of white spaces. A second poll will append to the file but
again only the last row (preceded by a bunch of spaces) to the file.

Again this all works fine with ftp - all the selected rows are
appended to the file and there are no additional spaces inserted.

Here is the route:


   
   
  
   
   



And the endpoints are resolved to:

sftp://xfer.companyname.net:22/Dev/terminal_import?fileExist=Append&fileName=punches.csv&password=**&username=username.com

sql://select * from my_table where
STATUS=0?consumer.delay=6&consumer.onConsume=update my_table set
STATUS = 1 where STATUS = 0


This is a standalone java application using a spring container. I’m
using jdk 1.7.07, Camel 2.11 and sqljdbc4.


As I'm new with Apache Camel, the root cause is probably simple. Any
help would be highly appreciated.


Thanks,
Lumi


jsf and apache camel

2013-07-17 Thread lassesvestergaard
Hi all.

I'm learning camel and jsf at the same time. What I want to do is to create
a jsf web application where it is possible to create, edit and delete
routes. This means that I need to have camel running in the background for
ever. I want to put camel inside a war, and when the application is deployed
on a tomcat server, Camel will start and I can begin making routes through a
browser.

My initial problem is that I don't know how to run camel in the background
of a jsf application. Web applications are only request scoped, so how do i
configure jsf to keep part of the web application alive constantly? I know
this is not directly related to Camel, but it's part of my problem and I
decided to start from this forum. Please post any articles you might find
relevant on this matter.

My next issue is more directly related to camel. I want to be able to create
routes with anonymous Processor objects (for simple conversion of data). As
far as I understand it, this is only possible through native java, and not
using xml. This means that I can't create anonymous Processor objects with
ex. Spring. Furthermore I can't use the "Camel web applications without
Spring example"
(http://www.javacodegeeks.com/2013/01/camel-2-11-camel-web-applications-without-spring.html).
Is this correctly understood? If not, please provide a link to where I can
learn more.

I know about hawt.io, and it seems like you can't create an anonymous
Processor objects there either.

Best regards



--
View this message in context: 
http://camel.465427.n5.nabble.com/jsf-and-apache-camel-tp5735818.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exceptions when aggregating messages

2013-07-17 Thread Christian Müller
Check out the Camel JMS page. Look for the transferExchane option.

Best,
Christian
Am 17.07.2013 07:19 schrieb "cristisor" :

> I'm afraid that I don't understand which option you are talking about. And
> how can I "care about the the property value which could not be
> serialized",
> please explain in more details if possible?
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Exceptions-when-aggregating-messages-tp5735523p5735765.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


@XmlElement overriding @JsonProperty

2013-07-17 Thread Craig Tataryn
I'm working on a little route for my blog feed, essentially I have a route
that looks like this:

from("rss:...")
.marshal().rss()
.split(xpath("//item"))
.unmarshal(jaxb)
//do stuff to my Article object
.marshal().json(JsonLibrary.Jackson)

My problem is, when I marshal my model object to json I don't want it to
have the same names as the element names from the XML the object was
created from.

So for instance, the model object that is created by JAXB has properties
such as:

@XmlElement(name = "encoded",namespace = "
http://purl.org/rss/1.0/modules/content/";)
@JsonProperty("body")
public void setBody(String body)...

What appears to be happening is the json marshalling seems to be respecting
the element name from the @XmlElement annotation instead of the name given
in the @JsonProperty annotation.  In fact, it appears to ignore all @Json*
annotations for any property that has an @XmlElement annotation associated
with it.  So instead of "body": properties in my json I end up with
"encoded": properties

Has anyone else run into this?  It's pretty maddening :(

Thanks,

Craig

-- 
Craig Tataryn
site: http://www.basementcoders.com/
irc: ThaDon on freenode #basementcoders
twitter: craiger


Groovy script synchronized issue with 2.10.x and 2.11.x prevents camel groovy script for High Concurrenc

2013-07-17 Thread apatel
In below code why method is synchronized? This prevents camel groovy script
for High Concurrency.


protected synchronized Object evaluateScript(Exchange exchange) {
try {
getScriptContext();
populateBindings(getEngine(), exchange);
addScriptEngineArguments(getEngine(), exchange);
Object result = runScript(exchange);
LOG.debug("The script evaluation result is: {}", result);
return result;
} catch (ScriptException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Script evaluation failed: " + e.getMessage(), e);
}
throw createScriptEvaluationException(e.getCause());
} catch (IOException e) {
throw createScriptEvaluationException(e);
}
}




I've below two routes. When i tested this route with 1 tps it returns
responses in avg 1005 ms but when i tested same route with 5tps it returns
responses in avg 8005 ms. My goal is tuning this routes for High
Concurrency.

http://camel.apache.org/schema/spring"; trace="true">
  



http://camel.apache.org/schema/spring"; 
errorHandlerRef="noErrorHandler">
 
  

 
 Thread.sleep(1000) 
 return "OK"



 
foo





I think we've found the root cause of our groovy performance problem. I did
a little testing this morning and found that a single thread test with the
route that waits 1 second had an average response time of about 1005
milliseconds. When I took this to 5 threads the average response time went
up to 4389. When I went to 10 threads the average went to 9169. This is all
without any pauses in the script so each thread is hitting the server as
soon as the result returns.

Here's the pattern of response times at the beginning of the 10 thread test:

1004, 1101, 2201, 3303, 4403, 5504, 6605, 7705, 8806, 9908, 2000, 4001,
6001, 8002, 10003, 12003, 14005, 16005, 18006

Interestingly the 3rd thread took 2.2 seconds, the 4th thread took 3.3
seconds, the 5th thread 5.5 seconds and so on. This clearly pointed to some
sort of semaphore or single resource that each thread was waiting for in
turn.

I took a look at the active threads using console. Here's where most of the
worker threads (http-bio-8080-exec-) were waiting:

Name: http-bio-8080-exec-3
State: BLOCKED on org.apache.camel.builder.script.ScriptBuilder@12349d8
owned by: http-bio-8080-exec-6
Total blocked: 99  Total waited: 271

Stack trace: 
org.apache.camel.builder.script.ScriptBuilder.evaluateScript(ScriptBuilder.java:338)
org.apache.camel.builder.script.ScriptBuilder.evaluate(ScriptBuilder.java:92)
org.apache.camel.builder.script.ScriptBuilder.evaluate(ScriptBuilder.java:96)
org.apache.camel.builder.ProcessorBuilder$4.process(ProcessorBuilder.java:103)
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
 

from 
 --Doug 










--
View this message in context: 
http://camel.465427.n5.nabble.com/Groovy-script-synchronized-issue-with-2-10-x-and-2-11-x-prevents-camel-groovy-script-for-High-Concurc-tp5735815.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-netty consumer with multicast address

2013-07-17 Thread samel
Hello all,

I'm using Camel 2.11.0 and trying to use camel-netty to listen on a true
multicast UDP address (224.0.0.0 through 239.255.255.255 -
http://en.wikipedia.org/wiki/Multicast_address).  I don't see any exception
but I'm unable to get an messages through either. However, if I use
non-multicast addresses such as localhost or my own IP, things seem to work.
Does anybody have experience with this and any pointers?  Thanks in advance.

Here are my observiations

Environment
===
Karaf 2.3.1
Java 7
Camel 2.11.0

Experiment #1:  Localhost
===

Route
---

 


Sending URL
---
Client sending to udp://localhost:8001

Result

SUCCESS

Experiment #2:  Local IP Address
===

Route
---

 :8001?allowDefaultCodec=false&sync=false&broadcast=true"/>


Sending URL
---
Client sending to udp://:8001

Result

SUCCESS

Experiment #3:  Multicast Address
===

Route
---

 


Sending URL
---
Client sending to udp://225.1.1.1:8001

Result

FAIL




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-netty-consumer-with-multicast-address-tp5735823.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Message Processing Performance while splitting

2013-07-17 Thread Vic
I am processing big file - line by line with camel. The average amount of
processed messages per second is 30k. When I do the same in java using
BufferedReader - the average amount of processed messages per second is
500k. I am processing the same file. This is significant performance lost.
Am I doing something wrong in Camel?

camel route :

from("file:C:/Test?fileName=test_file.txt&noop=true")
.split().tokenize("\n").streaming()
.to("log:INFO?groupSize=1");

java code:

FileReader fr = new FileReader("C:/Test/test_file.txt");
BufferedReader br = new BufferedReader(fr);

long count = 0;
long start = System.currentTimeMillis();
while(br.readLine() != null)
{
count++;
if(count % 1 == 0)
{
long now = System.currentTimeMillis();
long msgPerSecond = 1000*count/(now-start);
System.out.println(msgPerSecond);
}
}

br.close();



--
View this message in context: 
http://camel.465427.n5.nabble.com/Message-Processing-Performance-while-splitting-tp5735824.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Error in camel-bindy

2013-07-17 Thread rameshkumar.m
Hi Jothi,You can do like this.*.unmarshal(new
BindyCsvDataFormat(de.test.model.MyModel.class);*



--
View this message in context: 
http://camel.465427.n5.nabble.com/Error-in-camel-bindy-tp5735580p5735825.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Replacing standalone client with generic one in cxf component

2013-07-17 Thread cannykanna
HI

I have a wsdl with has many operations and input parameters defined for
each.
Now I wrote a standalone client with talks to my endpoint which exposes its
services through webservices.
This client talks with this endpoint and only one operation is defined in
it.
Now What I am looking is as follows.
>From my starting triggering point I say I have to hit the endpoint and do
one operation on it say get operation.
Now through Camel the the message has to pass as defined by our routing and
hit that endpoint and give back the response as per our routing.
For this my client has to be replaced by a generic one.
How can I do this..? Any ideas?
And through my endpoint I can do any operation uses SOAP messages only.?
Does camel has SOAP Component?

For Any Extra Information, feel free to ask.

Regards,
Kannaiah



--
View this message in context: 
http://camel.465427.n5.nabble.com/Replacing-standalone-client-with-generic-one-in-cxf-component-tp5735827.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Error in camel-bindy

2013-07-17 Thread Jothi
As I understand from Claus's message is that it is not possible to specify
the class name to the BindyCsvDataFormat as this feature seems not to be
available with the camel version that I'm using!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Error-in-camel-bindy-tp5735580p5735828.html
Sent from the Camel - Users mailing list archive at Nabble.com.


problem processing CSV to Database (camel-csv and camel-sql)

2013-07-17 Thread vs.souza
Hello guys,

I built the following camel route using spring dsl:

UserCSVToMySQL.xml
  


http://www.springframework.org/schema/beans";
xmlns:camel="http://camel.apache.org/schema/spring"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:osgi="http://www.springframework.org/schema/osgi";
xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/spring-osgi.xsd";>
























 





but when I try to execute it keeps displaying the error:

21:12:53,677 | ERROR | read #46 - Split | DefaultErrorHandler  |
95 - org.apache.camel.camel-core - 2.10.3 | Failed delivery for (MessageId:
ID-ubuntu-32934-1374106272368-2-1 on ExchangeId:
ID-ubuntu-32934-1374106272368-2-4370). Exhausted after delivery attempt: 1
caught: org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
user(`id`,`external_user_id`,`first_name`,`last_name`,`email`,`active`)
VALUES (?,?,?,?,?)]; SQL state [null]; error code [0]; Number of parameters
mismatch. Expected: 5, was:1; nested exception is java.sql.SQLException:
Number of parameters mismatch. Expected: 5, was:1
org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
user(`id`,`external_user_id`,`first_name`,`last_name`,`email`,`active`)
VALUES (?,?,?,?,?)]; SQL state [null]; error code [0]; Number of parameters
mismatch. Expected: 5, was:1; nested exception is java.sql.SQLException:
Number of parameters mismatch. Expected: 5, was:1

Looks like that camel-sql is not understanding the ArrayList that is coming
to assign to each Insert parameter.

Below I send you a couple of registers that I have in my csv file that:

0,firstname0,lastname0,emailfromus...@usermail.com,1
1,firstname1,lastname1,emailfromus...@usermail.com,1
2,firstname2,lastname2,emailfromus...@usermail.com,1
3,firstname3,lastname3,emailfromus...@usermail.com,1
4,firstname4,lastname4,emailfromus...@usermail.com,1
5,firstname5,lastname5,emailfromus...@usermail.com,1
6,firstname6,lastname6,emailfromus...@usermail.com,1
7,firstname7,lastname7,emailfromus...@usermail.com,1
8,firstname8,lastname8,emailfromus...@usermail.com,1
9,firstname9,lastname9,emailfromus...@usermail.com,1
10,firstname10,lastname10,emailfromuse...@usermail.com,1
11,firstname11,lastname11,emailfromuse...@usermail.com,1
12,firstname12,lastname12,emailfromuse...@usermail.com,1
13,firstname13,lastname13,emailfromuse...@usermail.com,1
14,firstname14,lastname14,emailfromuse...@usermail.com,1
15,firstname15,lastname15,emailfromuse...@usermail.com,1
16,firstname16,lastname16,emailfromuse...@usermail.com,1
17,firstname17,lastname17,emailfromuse...@usermail.com,1
18,firstname18,lastname18,emailfromuse...@usermail.com,1
19,firstname19,lastname19,emailfromuse...@usermail.com,1
20,firstname20,lastname20,emailfromuse...@usermail.com,1
21,firstname21,lastname21,emailfromuse...@usermail.com,1
22,firstname22,lastname22,emailfromuse...@usermail.com,1
23,firstname23,lastname23,emailfromuse...@usermail.com,1
24,firstname24,lastname24,emailfromuse...@usermail.com,1
25,firstname25,lastname25,emailfromuse...@usermail.com,1
26,firstname26,lastname26,emailfromuse...@usermail.com,1
27,firstname27,lastname27,emailfromuse...@usermail.com,1
28,firstname28,lastname28,emailfromuse...@usermail.com,1

And my table structure is:

delimiter $$

CREATE TABLE `user` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `external_user_id` int(10) unsigned NOT NULL,
  `first_name` varchar(45) CHARACTER SET latin1 NOT NULL,
  `last_name` varchar(45) CHARACTER SET latin1 DEFAULT NULL,
  `email` varchar(45) CHARACTER SET latin1 NOT NULL,
  `active` bit(1) DEFAULT b'1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

Do you have any ideas about how to solve this problem? 

Thanks and regards.




--
View this message in context: 
http://camel.465427.n5.nabble.com/problem-processing-CSV-to-Database-camel-csv-and-camel-sql-tp5735821.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel error with simple program with camel-core-2.11.1.jar

2013-07-17 Thread vinay
Hi All,

I am new to camel, here is what I am trying and is giving me exception.

$groovy -v
Groovy Version: 2.1.3 JVM: 1.7.0_11 Vendor: Oracle Corporation OS: Linux
$groovy  CallCallista1.groovy

give following exception...
[main] INFO camelLogger - Exchange[ExchangePattern:InOut, BodyType:String,
Body
test message]
Caught: java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.
ang.String
java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.lang.Str
ng
at
org.apache.camel.impl.DefaultCamelContext.getProperty(DefaultCamelCo
text.java:2594)
at
org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHel
er.java:161)
at
org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHel
er.java:144)
at
org.apache.camel.impl.DefaultMessage.toString(DefaultMessage.java:46

at
org.apache.camel.impl.DefaultExchange.toString(DefaultExchange.java:
0)
at CallCallista1.run(CallCallista1.groovy:25)


and, here is program...
=
@Grab('org.apache.camel:camel-core:')
@Grab('org.slf4j:slf4j-simple:')
import org.apache.camel.*
import org.apache.camel.impl.*
import org.apache.camel.builder.*

class MyRouteBuilder extends org.apache.camel.builder.RouteBuilder {
  void configure() {
from("direct://foo")
 .to("log://camelLogger?level=INFO")
 .to("mock://result?retainLast=10")
  }
}

def mrb = new MyRouteBuilder()
def ctx = new org.apache.camel.impl.DefaultCamelContext()
ctx.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, true);
ctx.addRoutes mrb
ctx.start()
p = ctx.createProducerTemplate()
p.sendBody("direct:foo", ExchangePattern.InOut, "test message")

e = ctx.getEndpoint("mock://result?retainLast=10");
def ex = e.exchanges
println "INFO> ${ex.first()}"
println "INFO> ${ex.first().getException()}"





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-error-with-simple-program-with-camel-core-2-11-1-jar-tp5735829.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exceptions when aggregating messages

2013-07-17 Thread cristisor
Thanks for making things more clear. I read the documentation and I
understand your point.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exceptions-when-aggregating-messages-tp5735523p5735830.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel error with simple program with camel-core-2.11.1.jar

2013-07-17 Thread Claus Ibsen
Hi

Try with

ctx.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true");

On Thu, Jul 18, 2013 at 7:07 AM, vinay  wrote:
> Hi All,
>
> I am new to camel, here is what I am trying and is giving me exception.
>
> $groovy -v
> Groovy Version: 2.1.3 JVM: 1.7.0_11 Vendor: Oracle Corporation OS: Linux
> $groovy  CallCallista1.groovy
>
> give following exception...
> [main] INFO camelLogger - Exchange[ExchangePattern:InOut, BodyType:String,
> Body
> test message]
> Caught: java.lang.ClassCastException: java.lang.Boolean cannot be cast to
> java.
> ang.String
> java.lang.ClassCastException: java.lang.Boolean cannot be cast to
> java.lang.Str
> ng
> at
> org.apache.camel.impl.DefaultCamelContext.getProperty(DefaultCamelCo
> text.java:2594)
> at
> org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHel
> er.java:161)
> at
> org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHel
> er.java:144)
> at
> org.apache.camel.impl.DefaultMessage.toString(DefaultMessage.java:46
>
> at
> org.apache.camel.impl.DefaultExchange.toString(DefaultExchange.java:
> 0)
> at CallCallista1.run(CallCallista1.groovy:25)
>
>
> and, here is program...
> =
> @Grab('org.apache.camel:camel-core:')
> @Grab('org.slf4j:slf4j-simple:')
> import org.apache.camel.*
> import org.apache.camel.impl.*
> import org.apache.camel.builder.*
>
> class MyRouteBuilder extends org.apache.camel.builder.RouteBuilder {
>   void configure() {
> from("direct://foo")
>  .to("log://camelLogger?level=INFO")
>  .to("mock://result?retainLast=10")
>   }
> }
>
> def mrb = new MyRouteBuilder()
> def ctx = new org.apache.camel.impl.DefaultCamelContext()
> ctx.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, true);
> ctx.addRoutes mrb
> ctx.start()
> p = ctx.createProducerTemplate()
> p.sendBody("direct:foo", ExchangePattern.InOut, "test message")
>
> e = ctx.getEndpoint("mock://result?retainLast=10");
> def ex = e.exchanges
> println "INFO> ${ex.first()}"
> println "INFO> ${ex.first().getException()}"
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-error-with-simple-program-with-camel-core-2-11-1-jar-tp5735829.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: problem processing CSV to Database (camel-csv and camel-sql)

2013-07-17 Thread Claus Ibsen
Hi

I think CSV unmarshal to a List so you would need to turn that into a Map.

  



  ${body[0]}



On Thu, Jul 18, 2013 at 2:24 AM, vs.souza  wrote:
> Hello guys,
>
> I built the following camel route using spring dsl:
>
> UserCSVToMySQL.xml
> 
>
> 
> http://www.springframework.org/schema/beans";
> xmlns:camel="http://camel.apache.org/schema/spring";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:osgi="http://www.springframework.org/schema/osgi";
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
> http://www.springframework.org/schema/osgi
> http://www.springframework.org/schema/spring-osgi.xsd";>
>
>
> 
>  value="com.mysql.jdbc.Driver" />
>  value="jdbc:mysql://localhost:3306/sandbox-db"/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
> 
>  uri="file:/home/jedi/Java/Workspaces/FileSandbox?delete=true"
> />
>  streaming="true">
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
>
> but when I try to execute it keeps displaying the error:
>
> 21:12:53,677 | ERROR | read #46 - Split | DefaultErrorHandler  |
> 95 - org.apache.camel.camel-core - 2.10.3 | Failed delivery for (MessageId:
> ID-ubuntu-32934-1374106272368-2-1 on ExchangeId:
> ID-ubuntu-32934-1374106272368-2-4370). Exhausted after delivery attempt: 1
> caught: org.springframework.jdbc.UncategorizedSQLException:
> PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
> user(`id`,`external_user_id`,`first_name`,`last_name`,`email`,`active`)
> VALUES (?,?,?,?,?)]; SQL state [null]; error code [0]; Number of parameters
> mismatch. Expected: 5, was:1; nested exception is java.sql.SQLException:
> Number of parameters mismatch. Expected: 5, was:1
> org.springframework.jdbc.UncategorizedSQLException:
> PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
> user(`id`,`external_user_id`,`first_name`,`last_name`,`email`,`active`)
> VALUES (?,?,?,?,?)]; SQL state [null]; error code [0]; Number of parameters
> mismatch. Expected: 5, was:1; nested exception is java.sql.SQLException:
> Number of parameters mismatch. Expected: 5, was:1
>
> Looks like that camel-sql is not understanding the ArrayList that is coming
> to assign to each Insert parameter.
>
> Below I send you a couple of registers that I have in my csv file that:
>
> 0,firstname0,lastname0,emailfromus...@usermail.com,1
> 1,firstname1,lastname1,emailfromus...@usermail.com,1
> 2,firstname2,lastname2,emailfromus...@usermail.com,1
> 3,firstname3,lastname3,emailfromus...@usermail.com,1
> 4,firstname4,lastname4,emailfromus...@usermail.com,1
> 5,firstname5,lastname5,emailfromus...@usermail.com,1
> 6,firstname6,lastname6,emailfromus...@usermail.com,1
> 7,firstname7,lastname7,emailfromus...@usermail.com,1
> 8,firstname8,lastname8,emailfromus...@usermail.com,1
> 9,firstname9,lastname9,emailfromus...@usermail.com,1
> 10,firstname10,lastname10,emailfromuse...@usermail.com,1
> 11,firstname11,lastname11,emailfromuse...@usermail.com,1
> 12,firstname12,lastname12,emailfromuse...@usermail.com,1
> 13,firstname13,lastname13,emailfromuse...@usermail.com,1
> 14,firstname14,lastname14,emailfromuse...@usermail.com,1
> 15,firstname15,lastname15,emailfromuse...@usermail.com,1
> 16,firstname16,lastname16,emailfromuse...@usermail.com,1
> 17,firstname17,lastname17,emailfromuse...@usermail.com,1
> 18,firstname18,lastname18,emailfromuse...@usermail.com,1
> 19,firstname19,lastname19,emailfromuse...@usermail.com,1
> 20,firstname20,lastname20,emailfromuse...@usermail.com,1
> 21,firstname21,lastname21,emailfromuse...@usermail.com,1
> 22,firstname22,lastname22,emailfromuse...@usermail.com,1
> 23,firstname23,lastname23,emailfromuse...@usermail.com,1
> 24,firstname24,lastname24,emailfromuse...@usermail.com,1
> 25,firstname25,lastname25,emailfromuse...@usermail.com,1
> 26,firstname26,lastname26,emailfromuse...@usermail.com,1
> 27,firstname27,lastname27,emailfromuse...@usermail.com,1
> 28,firstname28,lastname28,emailfromuse...@usermail.com,1
>
> And my table structure is:
>
> delimiter $$
>
> CREATE TABLE `user` (
>   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>   `external_user_id` int(10) unsigned NOT NULL,
>   `first_name` varchar(45) CHARACTER SET latin1 NOT NULL

Re: Replacing standalone client with generic one in cxf component

2013-07-17 Thread Willem jiang
Hi,

What's the operation that your standalone client is invoking?
If you know which operation your client should invoke, you can set it 
throughout the camel-cxf endpoint uri.
If you want to change it dynamically, you can setup the message header per 
invocation.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem


Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, July 18, 2013 at 12:31 PM, cannykanna wrote:

> HI
>  
> I have a wsdl with has many operations and input parameters defined for
> each.
> Now I wrote a standalone client with talks to my endpoint which exposes its
> services through webservices.
> This client talks with this endpoint and only one operation is defined in
> it.
> Now What I am looking is as follows.
> From my starting triggering point I say I have to hit the endpoint and do
> one operation on it say get operation.
> Now through Camel the the message has to pass as defined by our routing and
> hit that endpoint and give back the response as per our routing.
> For this my client has to be replaced by a generic one.
> How can I do this..? Any ideas?
> And through my endpoint I can do any operation uses SOAP messages only.?
> Does camel has SOAP Component?
>  
> For Any Extra Information, feel free to ask.
>  
> Regards,
> Kannaiah
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Replacing-standalone-client-with-generic-one-in-cxf-component-tp5735827.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).