Re: How do I change message body without changing response status

2013-05-14 Thread kalyan
Thank you for the reply Claus.

However, the HTTP response code received is not constant. It changes with
the input url (like 400, 404, 500, 503 etc).

handled(true) is changing it to 200.

Is there a way to preserve the response code with out getting to know its
value ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-How-do-I-change-message-body-without-changing-response-status-tp5732419p5732422.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How do I change message body without changing response status

2013-05-14 Thread kalyan
I'm sorry.. but I have just found the solution.

what I needed was:

HttpOperationFailedException ex =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
HttpOperationFailedException.class);
ex.getStatusCode();

Thank you.



--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-How-do-I-change-message-body-without-changing-response-status-tp5732419p5732424.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to make route wait for aggregator to aggregate?

2013-05-14 Thread Paulius Gasėnas
Hi guys,

I‘m new to this forum.

We have an issue with multicast and aggregation.
Before calling route direct:putEvent, header correlationId  is also set, so 
correlation is working. Goal, that we are trying to achieve here, is that we 
need, that after message is sent to routeX, which sends message to 
rabbitmq:toQueue , after some time message is received in routeY , thus both 
messages can be aggregated in the aggregator, if their correlationId coincides. 
The problem here is that first route is not waiting for second message from 
routeY to arrive to aggregator, and returns right away. How can we make first 
route to wait until completionTimeout or completionSize conditions are 
satisfied?

Code:
camel:route id=routeX
camel:from uri=direct:putEvent /
camel:multicast stopOnException=true parallelProcessing=false
camel:to uri=rabbitmq:toQueue /
camel:to uri=direct:toAggregator /
/camel:multicast
/camel:route

camel:route id=routeY
camel:from uri=rabbitmq:fromOtherQueue /
camel:setHeader headerName=correlationId
camel:xpath 
resultType=java.lang.String//event[1]//id[1]/camel:xpath
/camel:setHeader
camel:to uri=direct:toAggregator /
/camel:route

camel:route id=aggregationRoute
camel:from uri=direct:toAggregator /
camel:aggregate strategyRef=myStrategy completionTimeout=7000 
parallelProcessing=false
eagerCheckCompletion=false
!-- aggregate all messages into the same group --
camel:correlationExpression
camel:simpleheader.correlationId/camel:simple
/camel:correlationExpression
camel:completionSize
camel:simple2/camel:simple
/camel:completionSize
/camel:aggregate
/camel:route

Thanks in advance.


--
Šioje žinutėje ir bet kokiuose jos prieduose pateikiama informacija yra 
konfidenciali ir jos panaudojimas ar atskleidimas gali būti apribotas. Ji 
skirta tik tam asmeniui, kuriam ji adresuota. Jei Jūs nesate adresatas arba 
atsakingas už šios žinutės pristatymą tam asmeniui, Jūs neturite teisės šios 
žinutės ar jos priedų kopijuoti, atskleisti, platinti ar kitaip perduoti jos 
turinio bet kuriam kitam asmeniui. Jei Jūs per klaidą gavote šią žinutę, 
prašome nedelsiant pranešti jos siuntėjui bei iškart ištrinti šią žinutę ir bet 
kokius jos priedus iš Jūsų sistemos.
--


Re: Simple Example of Using Redis Subscriber Doesn't work

2013-05-14 Thread Claus Ibsen
Hi

Thanks for letting us know. I can see there is a 1.0.4 release of
spring-data-redis. I wonder if that release works out of the box?


On Mon, May 13, 2013 at 10:11 PM, soumya_sd soumya...@yahoo.com wrote:
 I've posted a solution on the stackoverflow thread in case someone needs it
 in the future.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Simple-Example-of-Using-Redis-Subscriber-Doesn-t-work-tp5732138p5732445.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Numbers of lines in a flat file

2013-05-14 Thread Claus Ibsen
Hi

Seems a bit overkill to use EIP patterns to count the number of lines in a file.

Maybe use a java method call for that instead with code to read the
lines, and then at the end you can append the data also
http://javarevisited.blogspot.se/2012/07/read-file-line-by-line-java-example-scanner.html

Then call the java method from the Camel route etc.
http://camel.apache.org/bean


On Tue, May 14, 2013 at 4:27 AM, Baalu golivams...@gmail.com wrote:
 Hello,

 I am trying to count the number of the lines in a flatfile, once I get that
 value I need to write it back to the flat file as part of the file footer.

 For now I did this:

 from(direct:fileLinecount).routeId(fileCount)
 
 .pollEnrich(file://C:/filefolder?noop=true)
 .split().tokenize(\n).

 I can see one of the property as CamelSplitSize which has the number of
 the lines in the flat file. How to access this property? I am unable to get
 this value in my route with getProperty...any help would be appreciated.

 thanks!



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


JSON to POJO using Apache Camel and hibernate

2013-05-14 Thread bartleemans
Apache camel is using a route wich is listening to a specific url. the json
from this url is then transformed to pojo classes and inserted in a mySQL
database. Everything is working fine, except my foreign key still remains
null. I'm using spring framework btw.

Here is the url where you can find the data:
https://builds.apache.org:443/job/Accumulo-1.5/api/json

Here is my routedefinition for camel

@Component
public class JenkinsConfigurationRouteBuilder extends SpringRouteBuilder {

private Logger logger =
LoggerFactory.getLogger(JenkinsConfigurationRouteBuilder.class);

@Override
public void configure() throws Exception {

logger.info(Configuring route);

//Properties die hij niet vindt in de klasse negeren
ObjectMapper objectMapper = new ObjectMapper();
   
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES,
false);

DataFormat jenkinsConfigFormat = new JacksonDataFormat(objectMapper,
JenkinsConfiguration.class);

from(timer://foo?fixedRate=truedelay=0period=20repeatCount=1)
.routeId(jsonToJenkinsConfiguration)
.setHeader(Exchange.HTTP_METHOD, constant(GET))
.to(https://builds.apache.org:443/job/Accumulo-1.5/api/json;)
.convertBodyTo(String.class)
.unmarshal(jenkinsConfigFormat) //instance van
JenkinsConfiguration
.log(LoggingLevel.DEBUG, be.kdg.teamf, Project: ${body})
.to(hibernate:be.kdg.teamf.model.JenkinsConfiguration);


}

My POJO class

@Entity(name = jenkinsConfiguration)
public class JenkinsConfiguration extends Configuration implements
Serializable {

@Column
@JsonProperty(displayName)
private String name;

@JsonProperty(healthReport)
@JsonIgnore
@LazyCollection(LazyCollectionOption.FALSE)
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy =
(jenkinsConfig))
private CollectionHealthReport healthReport;

@JsonProperty(builds)
@JsonIgnore
@LazyCollection(LazyCollectionOption.FALSE)
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy =
(jenkinsConfig))
private CollectionBuild builds;

@JsonProperty(modules)
@JsonIgnore
@LazyCollection(LazyCollectionOption.FALSE)
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy =
(jenkinsConfig))
private CollectionModule modules;


public JenkinsConfiguration() {
}

public JenkinsConfiguration(CollectionBuild builds,
CollectionHealthReport healthReport, CollectionModule modules, String
name) {
this.builds = builds;
this.healthReport = healthReport;
this.modules = modules;
this.name = name;
}

public CollectionBuild getBuilds() {
return builds;
}

public CollectionHealthReport getHealthReport() {
return healthReport;
}

public CollectionModule getModules() {
return modules;
}

public String getName() {
return name;
}

public void setBuilds(CollectionBuild builds) {
this.builds = builds;
}

public void setHealthReport(CollectionHealthReport healthReport) {
this.healthReport = healthReport;
}

public void setModules(CollectionModule modules) {
this.modules = modules;
}

public void setName(String name) {
this.name = name;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}

}
}

Let us take the builds for instance. As you can see, this pojo class
contains a list from builds. A JenkinsConfiguration can contain more builds.
One build belongs to one JenkinsConfiguration.

This is my Build class:

@XmlRootElement(name = builds)
@Entity(name = build)
public class Build implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int Id;

@Column
@JsonProperty(number)
private Integer number;

@Column
@JsonProperty(url)
private String url;

@JsonBackReference
@OnDelete(action = OnDeleteAction.CASCADE)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = jenkinsConfig)
private JenkinsConfiguration jenkinsConfig;

public Build() {

}

public Build(JenkinsConfiguration jenkinsConfig, Integer number, String url)
{
this.jenkinsConfig = jenkinsConfig;
this.number = number;
this.url = url;
}

public int getId() {
return Id;
}

public JenkinsConfiguration getJenkinsConfig() {
return jenkinsConfig;
}

public Integer getNumber() {
return number;
}

public String getUrl() {
return url;
}

public void setId(int id) {
Id = id;
}

public void setJenkinsConfig(JenkinsConfiguration jenkinsConfig) {
this.jenkinsConfig = jenkinsConfig;
}

public void setNumber(Integer number) {
this.number = number;
}

public void setUrl(String url) {
this.url = url;
}
}

My question: how come that my foreign key is not set for the build class? it
remains null. Doe I need to update it manually or something? If so, can I do
this using camel by getting all the rows from my database and then updating
them?

Any help would me much appreciated!



--
View this message in context: 

Re: Slow startup of routes

2013-05-14 Thread Claus Ibsen
Hi

Your design is probably not good when you need to create a new route
to process each message.

Instead reuse the route(s) and use the dynamic EIPs if you need to
process the messages a bit differently.
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html


On Sun, May 12, 2013 at 9:10 AM, hussainpirosha
hussain.piro...@gmail.com wrote:
 Hi,

 I am using camel to implement dispatcher EIP. There are thousands of
 messages in a queue which needs to be delivered at different URLs. Each
 message has its own delivery URL and delivery protocol (ftp,email,http etc).

 The way we are implementing in Camel is
 - Boot a single camel context, the context is disabled for JMX and the
 loadStatisticsEnabled is set to false on the ManagementStrategy. As
 mentioned in a jira issue, addressed in 2.11.0 version, for disabling the
 background management thread creation.
 - For each message a route is being constructed , the message is being
 pushed to the route for delivery.
 - After the message is processed route is shutdown and removed from context.

 We did a small perf test by having 200 threads of dispatcher component, each
 sharing the same context.
 Observed that the time to start a route increases upto a maximum of 60
 seconds while the time to process is in milliseconds.

 Issue CAMEL-5675 mentions that this has been fixed but we are still
 observing significant time being taken in starting up routes.

 Pls suggest, what should we do to solve this.

 The route that we are creating for http is

 from(direct:+dispatchItem.getID()).toF(%s?httpClient.soTimeout=%sdisableStreamCache=true,
 dispatchItem.getEndPointURL(),timeOutInMillis);

 Each dispatchItem has a unique ID.

 Thanks,
 Hussain






 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Slow-startup-of-routes-tp5732356.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Steps to replace a direct call by a JMS proxy?

2013-05-14 Thread Christian Schneider
There is one additional thing you need. You have to call your route in 
some way.


There are two methods:
1. camelContext.createProducerTemplate().sendBody or similar
2. pojo messaging: http://camel.apache.org/pojo-messaging-example.html

Depending on your application it may make sense to use pojo messaging to 
separate your business code from the camel framework.


Christian


Am 14.05.2013 04:30, schrieb Christian Posta:

May want to take a look at some of the intro material:
http://camel.apache.org/getting-started.html

Essentially, you'll need to define a route builder that a builds a route
like:

from(direct:endpoint).throttle().to(jms:queueName)

http://camel.apache.org/cookbook.html
http://camel.apache.org/jms.html



On Mon, May 13, 2013 at 11:13 AM, Al Ferguson alfer...@hotmail.com wrote:


Hi,

I currently have a Java application that sends directly messages to a queue
using a Spring JmsTemplate:

I would like to take advantage of the facilities of Camel Throttling but I
do not see how to define my route. Could someone help me and tell me what I
have to do?

Regards,
Al. F



--
View this message in context:
http://camel.465427.n5.nabble.com/Steps-to-replace-a-direct-call-by-a-JMS-proxy-tp5732430.html
Sent from the Camel - Users mailing list archive at Nabble.com.







--
 
Christian Schneider

http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com



Re: Slow startup of routes

2013-05-14 Thread hussainpirosha
Thanks Claus for pointing out the mistake.

Changed the design to have a single route per protocol and now using the
dynamic EIP pattern to pass in the endpoint url and other parameters. The
new route looks like :

from(direct:http)
.recipientList(simple(http:${header.url}?
httpClient.soTimeout=${header.timeout}disableStreamCache=true));


Thanks,
Hussain








--
View this message in context: 
http://camel.465427.n5.nabble.com/Slow-startup-of-routes-tp5732356p5732473.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Streaming a PDF from remote machine

2013-05-14 Thread Chinababu Illa
Thanks Willem.

A bit more details on the problem.

There are 3 applications involved in this issue. FrontEnd, Link and Host.
Link sits between FrontEnd and Host. When FrontEnd sends a request (http
post) to Link it in turn sends a request to Host and also creates two
streams one to read from Host and other one to send the same data to
FrontEnd. Due to slow streaming from Host, the FrontEnd to download the file
is taking longer time. And we cannot afford user waiting for that longer.
So, want to terminate downloading after certain period of time.

Please find details below for your points.

*Are you using FTP to download the file?*
- /No./

*I'm not sure how the BufferedInputStream is involved.  *
- /FrontEnd reads response as Stream (InputStream) is how
BufferedInputStream involved here.
   We are wrapping InputStream with BufferedInputStream./

*If the file is downloaded, the BufferedInputStream will never time out.*
- /Consider a case where file is still downloading and read never gets
timedout as it is getting data (a less data) for every read/

*If the BufferedInputStream has the timeout mechanism, I don't think you
need to check if the File is download.*
- /BufferedInputStream has the timeout mechanism but it will never timeout
as it gets data within timeout period./


I have already got two solutions with me.

1) Implementing timeout manually (not a good idea, not elegant solution)
2) Create a message listener send a message to start downloading, send a
message to terminate downloading after certain time.
3) Looking if Camel can solve this by auto imposing timeout.

So, please let me know if Camel has a solution for this kind of problems. If
so, point me what to look into.

Thanks,
Chinna





--
View this message in context: 
http://camel.465427.n5.nabble.com/Streaming-a-PDF-from-remote-machine-tp5732401p5732474.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: onException: Global declaration at CamelHttpTransportServlet

2013-05-14 Thread Claus Ibsen
No you would need to create a base class, and have the onException in
that base class.
And then extend your base class and call super.configure(). (i.e. OO
inheritence) then you can have it for all your routes.

On Mon, May 13, 2013 at 8:00 PM, kalyan register.kal...@gmail.com wrote:
 When a RouteBuilder defines onException in the following way, is it available
 for all RouteBuilders of the same CamelContext ?

 RouteBuilder routeBuilder = new RouteBuilder()
 {
 @Override
 public void configure()
 {

 onException(HttpOperationFailedException.class).handled(true)
 .process(new Processor()
 {
 @Override
 public void process(Exchange exchange)
 throws Exception
 {
 //blah
 }
 }).transform().constant(There was an exception);

 from(servlet:///test?matchOnUriPrefix=true)
 .to(http://localhost:8080/mywar/sample?bridgeEndpoint=true;);
 }
 };

 However, I would like to know if:
 - There is a way to handle 404 error on CamelHttpTransportServlet where the
 url pattern is matched but no servlet:/// is found.
 - When there are multiple camel contexts; camelcontext1's router calls
 camelcontext2's route and camelcontext2's route had an exception. Can
 camelcontext1 see this as an exception (even though it did not happen in its
 context) ? What is the best way to handle these scenarios (where there could
 be exception propagation between camelcontexts)




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/onException-Global-declaration-at-CamelHttpTransportServlet-tp5732428.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How to persist data from aggregator?

2013-05-14 Thread Claus Ibsen
Hi

See this EIP
http://camel.apache.org/composed-message-processor.html

And use the splitter with the aggregation repository. Then you can
aggregate them easily back again in the same route.


On Mon, May 13, 2013 at 7:10 PM, RTernier ryan_tern...@hotmail.com wrote:
 I'm having an issue with aggregator.

 I have an incoming Web Service request that will be split into 2 messages
 and have the responses of both web requests aggregated together. This works
 fine, and I do get a good aggregated message within the aggregation route.

 However, once I'm out of that route and it goes back to the main calling
 route (bottom one) the message is not what is aggregated, it's one of the
 responses from a web service call.  How do I force the aggregated message to
 be the envelop that camel uses?

 Here is my spring XML:








 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-to-persist-data-from-aggregator-tp5732421.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


QueryParam value with (ampersand)

2013-05-14 Thread jamalissimo
Hi guys,

I am working on file upload route and when I want to upload file and it's
name contains  character, then I will get this error:

java.lang.ArrayIndexOutOfBoundsException: 1

Camel awaits certain number of QueryParams which are defined beforehand.
When it finds  it will detect it as next QueryParam and the array is
overflown. 

I am reading this file from my machine and it's being uploaded to the
server. During the upload I use URLDecoder for other special characters. I
don't know how to tell Camel that it is only a string

-Thanks

Roman



--
View this message in context: 
http://camel.465427.n5.nabble.com/QueryParam-value-with-ampersand-tp5732487.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Steps to replace a direct call by a JMS proxy?

2013-05-14 Thread Al Ferguson
Thank you.

As a first step, I would like to get it working using a template. When done,
Maybe I'll separate the logic in a separate bean.

But... How to make throttling with using a producertemplate? Is is possible?

Thanks,
Al. F



--
View this message in context: 
http://camel.465427.n5.nabble.com/Steps-to-replace-a-direct-call-by-a-JMS-proxy-tp5732430p5732488.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Steps to replace a direct call by a JMS proxy?

2013-05-14 Thread Christian Schneider
You just send to direct:endpoint. This will trigger the route 
Christian Posta described and the throttling should work.


You can of course not directly define the throttling in the 
producerTemplate as you only can define an endpoint uri. For this case 
we have the direct endpoint that can then nicely bridge to an existing 
route without any further indirection.


Christian

On 14.05.2013 14:15, Al Ferguson wrote:

Thank you.

As a first step, I would like to get it working using a template. When done,
Maybe I'll separate the logic in a separate bean.

But... How to make throttling with using a producertemplate? Is is possible?

Thanks,
Al. F



--
View this message in context: 
http://camel.465427.n5.nabble.com/Steps-to-replace-a-direct-call-by-a-JMS-proxy-tp5732430p5732488.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com



Why is lazyLoadTypeConverters deprecated ?

2013-05-14 Thread kalyan
Hello,

I see that lazyLoadTypeConverters of DefaultCamelContext is deprecated. 

I notice that when this option is enabled by default, it is loading 181
TypeConverters by default. Does this mean 181 classes (including
inner/anonymous classes)

Assuming that this is quite a amount of PermGen space, I have set the
property to false and tried a try run on my code and it seems to work fine
(I don't have any custom Type Converters in code).

Is there any specific reason for doing this ? I ask because it could save
memory and may prove to be useful after all.

Regards,
Kalyan





--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-is-lazyLoadTypeConverters-deprecated-tp5732492.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: onException: Global declaration at CamelHttpTransportServlet

2013-05-14 Thread kalyan
Thank you. So I guess, the same holds good for handling the exceptions in vm,
direct-vm calls.



--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-Global-declaration-at-CamelHttpTransportServlet-and-bestpractices-tp5732428p5732491.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Streaming a PDF from remote machine

2013-05-14 Thread Willem jiang
I'm afraid you have to implement the timeout mechanism yourself.
I don't aware camel provides this feature out of box.

BTW, I think the solution2 that you have is a good one.   

--  
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 Tuesday, May 14, 2013 at 4:46 PM, Chinababu Illa wrote:

 Thanks Willem.
  
 A bit more details on the problem.
  
 There are 3 applications involved in this issue. FrontEnd, Link and Host.
 Link sits between FrontEnd and Host. When FrontEnd sends a request (http
 post) to Link it in turn sends a request to Host and also creates two
 streams one to read from Host and other one to send the same data to
 FrontEnd. Due to slow streaming from Host, the FrontEnd to download the file
 is taking longer time. And we cannot afford user waiting for that longer.
 So, want to terminate downloading after certain period of time.
  
 Please find details below for your points.
  
 *Are you using FTP to download the file?*
 - /No./
  
 *I'm not sure how the BufferedInputStream is involved. *
 - /FrontEnd reads response as Stream (InputStream) is how
 BufferedInputStream involved here.
 We are wrapping InputStream with BufferedInputStream./
  
 *If the file is downloaded, the BufferedInputStream will never time out.*
 - /Consider a case where file is still downloading and read never gets
 timedout as it is getting data (a less data) for every read/
  
 *If the BufferedInputStream has the timeout mechanism, I don't think you
 need to check if the File is download.*
 - /BufferedInputStream has the timeout mechanism but it will never timeout
 as it gets data within timeout period./
  
  
 I have already got two solutions with me.
  
 1) Implementing timeout manually (not a good idea, not elegant solution)
 2) Create a message listener send a message to start downloading, send a
 message to terminate downloading after certain time.
 3) Looking if Camel can solve this by auto imposing timeout.
  
 So, please let me know if Camel has a solution for this kind of problems. If
 so, point me what to look into.
  
 Thanks,
 Chinna
  
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Streaming-a-PDF-from-remote-machine-tp5732401p5732474.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





bind programmatically

2013-05-14 Thread Jean Francois LE BESCONT
Hey !

I would like to programmatically marshal and bind my body to do :

from(file://C:/Temp/camel/rep1/?noop=true)
   .split().tokenize(\n)
   .unmarshal()
   .bindy(BindyType.Csv, Ticket.class)
   .process(new Processor() {
  public void process(Exchange exchange) throws Exception {
 Ticket ticket = (Ticket) exchange.getIn().getBody() ;

 // Convert from ticket to CSV which is @CsvRecord
 String or byte[] ticketInCSVOrignal =???  ( ticket )
 ticket.originalVersion =  ticketInCSVOrignal

 // modify ticket start here
  }
   })
   [...]


Something that will do the equivalent of  :

.marshal()
.bindy(BindyType.Csv, Ticket.class)



I have look typeConverter and dataformat, but I am a little bit lost

Any idea ?

Thanks !

Jeff


CamelContext not loaded during Tests

2013-05-14 Thread lawrence

Hi,
I am kind of new to Camel, and I can't figure out why my camel context is
not loaded when running my tests.
I want to configure my context properly before deep diving into code, and
even with a basic example, and I can't make it.

I'd like to test existing routes (to avoid duplicating routes in code and
tests). I am pretty clear with adviceWith() and weave*(), but when I start
my tests, I have no routes loaded resulting in some NPE when calling
context.getRoutes(xx)
I use some mongoDB bean (but this works fine, no worries on that) that input
5 messages in the route.
I try to weave a mockEndpoint at the end of my route to check that the 5
messages get there.

My guess is that as the camel-context has its own @id, I should load this
particular context, not the default CamelContext, but
1/ if I anonymise the context (get rid of the @id), I still have the same
problem (which makes me say it is not such a good hint...)
2/ I can't find how to grab the named context

Any help appreciated!

Here are my samples:

*src/main/resources/META-INF/spring/application-context.xml*
eholder location=classpath:**.properties/
//blabla + some beans

*src/main/resources/META-INF/spring/camel-context.xml*


*src/main/.../testbuilder.java*


*src/test/resources/META-INF/spring/test-application-context.xml*



*src/test/resources/META-INF/spring/test-camel-context.xml*



*src/test/.../TestBuilderTest.java*






--
View this message in context: 
http://camel.465427.n5.nabble.com/CamelContext-not-loaded-during-Tests-tp5732498.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CamelContext not loaded during Tests

2013-05-14 Thread Claus Ibsen
Hi

You should use CamelSpringTestSupport from camel-test-spring to test
spring xml apps.

On Tue, May 14, 2013 at 5:00 PM, lawrence
lawrence.car...@pressinnov.com wrote:

 Hi,
 I am kind of new to Camel, and I can't figure out why my camel context is
 not loaded when running my tests.
 I want to configure my context properly before deep diving into code, and
 even with a basic example, and I can't make it.

 I'd like to test existing routes (to avoid duplicating routes in code and
 tests). I am pretty clear with adviceWith() and weave*(), but when I start
 my tests, I have no routes loaded resulting in some NPE when calling
 context.getRoutes(xx)
 I use some mongoDB bean (but this works fine, no worries on that) that input
 5 messages in the route.
 I try to weave a mockEndpoint at the end of my route to check that the 5
 messages get there.

 My guess is that as the camel-context has its own @id, I should load this
 particular context, not the default CamelContext, but
 1/ if I anonymise the context (get rid of the @id), I still have the same
 problem (which makes me say it is not such a good hint...)
 2/ I can't find how to grab the named context

 Any help appreciated!

 Here are my samples:

 *src/main/resources/META-INF/spring/application-context.xml*
 eholder location=classpath:**.properties/
 //blabla + some beans

 *src/main/resources/META-INF/spring/camel-context.xml*


 *src/main/.../testbuilder.java*


 *src/test/resources/META-INF/spring/test-application-context.xml*



 *src/test/resources/META-INF/spring/test-camel-context.xml*



 *src/test/.../TestBuilderTest.java*






 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/CamelContext-not-loaded-during-Tests-tp5732498.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


JAXB Interface Issue

2013-05-14 Thread David Carver
With Open JDK 7 we have been getting some odd issues lately when running 
camel in an equinox container.  The following is the stack trace we get:


org.springframework.beans.factory.config.BeanPostProcessor is an 
interface, and JAXB can't handle interfaces.

this problem is related to the following location:
at org.springframework.beans.factory.config.BeanPostProcessor
at public org.springframework.beans.factory.config.BeanPostProcessor 
org.apache.camel.spring.CamelContextFactoryBean.getBeanPostProcessor()

at org.apache.camel.spring.CamelContextFactoryBean

at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:212) 
~[jaxb-api_2.2.7.jar:na]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146) 
~[jaxb-api_2.2.7.jar:na]

... 159 common frames omitted
Caused by: 
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 39 
counts of IllegalAnnotationExceptions
at 
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91) 
~[na:1.7.0_21]
at 
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451) 
~[na:1.7.0_21]
at 
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java:283) 
~[na:1.7.0_21]
at 
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java:126) 
~[na:1.7.0_21]
at 
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148) 
~[na:1.7.0_21]
at 
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:130) 
~[na:1.7.0_21]
at 
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:221) 
~[na:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[na:1.7.0_21]
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
~[na:1.7.0_21]
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
~[na:1.7.0_21]

at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186) 
~[jaxb-api_2.2.7.jar:na]

... 160 common frames omitted

This is running with springframework 3.1.2.   I'm running out of ideas 
as to what can cause this issue as the JAXB implementation is being 
brough in from the jdk.  Anybody else seen this issue?


Dave



Why is Camel silently dropping exceptions?

2013-05-14 Thread Chris Wolf
I implemented a custom route policy, which never appeared to be
starting.  I finally traced with a debugger
and found that it's throwing an exception, which appears to be discarded.

In the DefaultCamelContext.addRoutes(...) is this code:

if (routePolicyList != null  !routePolicyList.isEmpty()) {
  for (RoutePolicy policy : routePolicyList) {
// add policy as service if we have not already done that (eg
possible if two routes have the same service)
// this ensures Camel can control the lifecycle of the policy
if (!camelContext.hasService(policy)) {
  try {
camelContext.addService(policy);
} catch (Exception e) {
  throw ObjectHelper.wrapRuntimeCamelException(e); === Never seen
in log or console-  where is it?
}
  }
}

Obviously, I am not understanding how exceptions are handled in Camel
- can someone help me?

Thanks,

Chris


Logging cause of failure with deadLetterChannel error handler?

2013-05-14 Thread Peter Hilton
How should I approach the following scenario? I’m starting to suspect that I'm 
doing it wrong…

I'm using: Camel 2.11.0, Scala DSL, Scala 2.10.0, sbt 0.12.2, JDK 1.6.0_43, OSX 
10.8.3


I have a route that takes a file, parses it and then sends JSON to a web 
service. If the Camel processor that parses the file throws a parse exception, 
the configured error handler moves the file to the dead letter endpoint. This 
much works.

errorHandler(deadLetterChannel(failureEndpoint).disableRedelivery())

However, I *also* want to log an error with the parse exception that the parser 
throws. How should I do this?

First, I’m confused by the documentation and examples I’ve found: they suggest 
using a log or a file but not both. It isn’t weird to want to both move an 
invalid input file to a dead letter 'failure' directory and to log the cause of 
the failure. Should the error handler be doing both?

The following is as far as we got, adding our custom 'ErrorProcessor' so we 
could customise the log output:

case class ErrorProcessor(implicit routeId: String) extends 
CamelProcessor {

  def process(exchange: Exchange): Unit = {
val formatString = Error [%s] while processing [%s]
val exception = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT).asInstanceOf[Throwable]
val message = formatString.format(exception.getMessage, 
exchange.getIn.getHeaders.get(CamelFileNameOnly).asInstanceOf[String])
Logger.error(message, exception)
  }
}

…

val deadLetterErrorHandler = 
deadLetterChannel(failureEndpoint).disableRedelivery()
deadLetterErrorHandler.setFailureProcessor(ErrorProcessor())
errorHandler(deadLetterErrorHandler)

This is okay, but I would prefer to encapsulate all of the above in a single 
component that I can then give to errorHandler(…) for every route builder.

We tried to make a custom DeadLetterChannelBuilder, but it didn't work: we 
tried overriding getFailureProcessor to return our customer error processor, 
but its process method was never called.

What is the correct way to customise log output for DeadLetterChannelBuilder 
whose endpoint is a directory that the message (file) will be moved to?

How much of this can I do using standard Camel components and the Scala DSL?

Peter

Re: Why is Camel silently dropping exceptions? *** DISREGARD ***

2013-05-14 Thread Chris Wolf
After RTFM, I see what's happening  - sorry for the noise...

On Tue, May 14, 2013 at 11:49 AM, Chris Wolf cwolf.a...@gmail.com wrote:
 I implemented a custom route policy, which never appeared to be
 starting.  I finally traced with a debugger
 and found that it's throwing an exception, which appears to be discarded.

 In the DefaultCamelContext.addRoutes(...) is this code:

 if (routePolicyList != null  !routePolicyList.isEmpty()) {
   for (RoutePolicy policy : routePolicyList) {
 // add policy as service if we have not already done that (eg
 possible if two routes have the same service)
 // this ensures Camel can control the lifecycle of the policy
 if (!camelContext.hasService(policy)) {
   try {
 camelContext.addService(policy);
 } catch (Exception e) {
   throw ObjectHelper.wrapRuntimeCamelException(e); === Never seen
 in log or console-  where is it?
 }
   }
 }

 Obviously, I am not understanding how exceptions are handled in Camel
 - can someone help me?

 Thanks,

 Chris


Re: How to persist data from aggregator?

2013-05-14 Thread RTernier
Hey Claus,

Thanks for the reply. I looked at that pattern, and I do get the aggregated
results back properly - in the Aggregate route. However, once processing
continues past that the exchange reverts back to what it was before it got
split-aggregated.

Using the link you posted, I changed my batch route to the following:


As you can see, I aggregate after the split. Before I sent each message to
the aggregate inside the camel:when.

However, this and the previous give the same result:

When logHere3 is hit, the exchange is the same as the one that got split,
not the one that got aggregated.

How can I fix this?




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-persist-data-from-aggregator-tp5732421p5732505.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Issue with Camel-aws (SQS) and aws-java-sdk-1.4.3

2013-05-14 Thread Shauna Harris
Thanks, that helped me. I reverted to that version and fixed the original
problem I had there.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Issue-with-Camel-aws-SQS-and-aws-java-sdk-1-4-3-tp5732228p5732504.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to persist data from aggregator?

2013-05-14 Thread Claus Ibsen
Hi

See the link again, and use *only* the splitter, as it has built-in aggregation.

On Tue, May 14, 2013 at 6:36 PM, RTernier ryan_tern...@hotmail.com wrote:
 Hey Claus,

 Thanks for the reply. I looked at that pattern, and I do get the aggregated
 results back properly - in the Aggregate route. However, once processing
 continues past that the exchange reverts back to what it was before it got
 split-aggregated.

 Using the link you posted, I changed my batch route to the following:


 As you can see, I aggregate after the split. Before I sent each message to
 the aggregate inside the camel:when.

 However, this and the previous give the same result:

 When logHere3 is hit, the exchange is the same as the one that got split,
 not the one that got aggregated.

 How can I fix this?




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-to-persist-data-from-aggregator-tp5732421p5732505.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: bind programmatically

2013-05-14 Thread Claus Ibsen
From your processor you can just create the bindy data format and
invoke the marshal method.

eg add camel-bindy to your class path, and find the BindyDataFormat
class and create a new instance, configure it, and invoke the marshal
method manually.

Its a bit unusual to do it like that, but you can do it.

On Tue, May 14, 2013 at 4:02 PM, Jean Francois LE BESCONT
jflebesc...@gmail.com wrote:
 Hey !

 I would like to programmatically marshal and bind my body to do :

 from(file://C:/Temp/camel/rep1/?noop=true)
.split().tokenize(\n)
.unmarshal()
.bindy(BindyType.Csv, Ticket.class)
.process(new Processor() {
   public void process(Exchange exchange) throws Exception {
  Ticket ticket = (Ticket) exchange.getIn().getBody() ;

  // Convert from ticket to CSV which is @CsvRecord
  String or byte[] ticketInCSVOrignal =???  ( ticket )
  ticket.originalVersion =  ticketInCSVOrignal

  // modify ticket start here
   }
})
[...]


 Something that will do the equivalent of  :

 .marshal()
 .bindy(BindyType.Csv, Ticket.class)



 I have look typeConverter and dataformat, but I am a little bit lost

 Any idea ?

 Thanks !

 Jeff



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: JSON to POJO using Apache Camel and hibernate

2013-05-14 Thread Claus Ibsen
Hi

For the foregin key stuff, you may want to ask on Hibernate forums how
to do that.

And what hibernate component do you use? And what version is that?
As well what version of Hibernate.



On Tue, May 14, 2013 at 8:59 AM, bartleemans bartleema...@msn.com wrote:
 Apache camel is using a route wich is listening to a specific url. the json
 from this url is then transformed to pojo classes and inserted in a mySQL
 database. Everything is working fine, except my foreign key still remains
 null. I'm using spring framework btw.

 Here is the url where you can find the data:
 https://builds.apache.org:443/job/Accumulo-1.5/api/json

 Here is my routedefinition for camel

 @Component
 public class JenkinsConfigurationRouteBuilder extends SpringRouteBuilder {

 private Logger logger =
 LoggerFactory.getLogger(JenkinsConfigurationRouteBuilder.class);

 @Override
 public void configure() throws Exception {

 logger.info(Configuring route);

 //Properties die hij niet vindt in de klasse negeren
 ObjectMapper objectMapper = new ObjectMapper();

 objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES,
 false);

 DataFormat jenkinsConfigFormat = new JacksonDataFormat(objectMapper,
 JenkinsConfiguration.class);

 from(timer://foo?fixedRate=truedelay=0period=20repeatCount=1)
 .routeId(jsonToJenkinsConfiguration)
 .setHeader(Exchange.HTTP_METHOD, constant(GET))
 .to(https://builds.apache.org:443/job/Accumulo-1.5/api/json;)
 .convertBodyTo(String.class)
 .unmarshal(jenkinsConfigFormat) //instance van
 JenkinsConfiguration
 .log(LoggingLevel.DEBUG, be.kdg.teamf, Project: ${body})
 .to(hibernate:be.kdg.teamf.model.JenkinsConfiguration);


 }

 My POJO class

 @Entity(name = jenkinsConfiguration)
 public class JenkinsConfiguration extends Configuration implements
 Serializable {

 @Column
 @JsonProperty(displayName)
 private String name;

 @JsonProperty(healthReport)
 @JsonIgnore
 @LazyCollection(LazyCollectionOption.FALSE)
 @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy =
 (jenkinsConfig))
 private CollectionHealthReport healthReport;

 @JsonProperty(builds)
 @JsonIgnore
 @LazyCollection(LazyCollectionOption.FALSE)
 @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy =
 (jenkinsConfig))
 private CollectionBuild builds;

 @JsonProperty(modules)
 @JsonIgnore
 @LazyCollection(LazyCollectionOption.FALSE)
 @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy =
 (jenkinsConfig))
 private CollectionModule modules;


 public JenkinsConfiguration() {
 }

 public JenkinsConfiguration(CollectionBuild builds,
 CollectionHealthReport healthReport, CollectionModule modules, String
 name) {
 this.builds = builds;
 this.healthReport = healthReport;
 this.modules = modules;
 this.name = name;
 }

 public CollectionBuild getBuilds() {
 return builds;
 }

 public CollectionHealthReport getHealthReport() {
 return healthReport;
 }

 public CollectionModule getModules() {
 return modules;
 }

 public String getName() {
 return name;
 }

 public void setBuilds(CollectionBuild builds) {
 this.builds = builds;
 }

 public void setHealthReport(CollectionHealthReport healthReport) {
 this.healthReport = healthReport;
 }

 public void setModules(CollectionModule modules) {
 this.modules = modules;
 }

 public void setName(String name) {
 this.name = name;
 }

 @Override
 public String toString() {
 return ToStringBuilder.reflectionToString(this);
 }

 }
 }

 Let us take the builds for instance. As you can see, this pojo class
 contains a list from builds. A JenkinsConfiguration can contain more builds.
 One build belongs to one JenkinsConfiguration.

 This is my Build class:

 @XmlRootElement(name = builds)
 @Entity(name = build)
 public class Build implements Serializable {
 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 private int Id;

 @Column
 @JsonProperty(number)
 private Integer number;

 @Column
 @JsonProperty(url)
 private String url;

 @JsonBackReference
 @OnDelete(action = OnDeleteAction.CASCADE)
 @ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = jenkinsConfig)
 private JenkinsConfiguration jenkinsConfig;

 public Build() {

 }

 public Build(JenkinsConfiguration jenkinsConfig, Integer number, String url)
 {
 this.jenkinsConfig = jenkinsConfig;
 this.number = number;
 this.url = url;
 }

 public int getId() {
 return Id;
 }

 public JenkinsConfiguration getJenkinsConfig() {
 return jenkinsConfig;
 }

 public Integer getNumber() {
 return number;
 }

 public String getUrl() {
 return url;
 }

 public void setId(int id) {
 Id = id;
 }

 public void setJenkinsConfig(JenkinsConfiguration jenkinsConfig) {
 this.jenkinsConfig = jenkinsConfig;
 }

 public void setNumber(Integer number) {
 this.number = number;
 }

 public void setUrl(String url) {
   

Re: JAXB Interface Issue

2013-05-14 Thread Claus Ibsen
Hi

You can possible add jaxb-impl JAR to the classpath so you can control
which JAXB impl is in use.
The ones from the JDK is sometimes outdated and buggy.



On Tue, May 14, 2013 at 5:04 PM, David Carver dcar...@intalio.com wrote:
 With Open JDK 7 we have been getting some odd issues lately when running
 camel in an equinox container.  The following is the stack trace we get:

 org.springframework.beans.factory.config.BeanPostProcessor is an interface,
 and JAXB can't handle interfaces.
 this problem is related to the following location:
 at org.springframework.beans.factory.config.BeanPostProcessor
 at public org.springframework.beans.factory.config.BeanPostProcessor
 org.apache.camel.spring.CamelContextFactoryBean.getBeanPostProcessor()
 at org.apache.camel.spring.CamelContextFactoryBean

 at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:212)
 ~[jaxb-api_2.2.7.jar:na]
 at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
 ~[jaxb-api_2.2.7.jar:na]
 ... 159 common frames omitted
 Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:
 39 counts of IllegalAnnotationExceptions
 at
 com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
 ~[na:1.7.0_21]
 at
 com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451)
 ~[na:1.7.0_21]
 at
 com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java:283)
 ~[na:1.7.0_21]
 at
 com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java:126)
 ~[na:1.7.0_21]
 at
 com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148)
 ~[na:1.7.0_21]
 at
 com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:130)
 ~[na:1.7.0_21]
 at
 com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:221)
 ~[na:1.7.0_21]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 ~[na:1.7.0_21]
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 ~[na:1.7.0_21]
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:1.7.0_21]
 at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21]
 at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
 ~[jaxb-api_2.2.7.jar:na]
 ... 160 common frames omitted

 This is running with springframework 3.1.2.   I'm running out of ideas as to
 what can cause this issue as the JAXB implementation is being brough in from
 the jdk.  Anybody else seen this issue?

 Dave




-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Why is lazyLoadTypeConverters deprecated ?

2013-05-14 Thread Claus Ibsen
Hi

Type converters should be loaded and instantiated as part of booting up Camel.
Doing this lazy just causes problems as you need to sync access to the
converters on first lazy loading and whatnot.

And there is no noticeable memory savings as the .class is on your
classpath and loaded as part of the components they come with.

If you want to save memory then profile your app and see what takes up
/ or what leaks etc.

On Tue, May 14, 2013 at 3:17 PM, kalyan register.kal...@gmail.com wrote:
 Hello,

 I see that lazyLoadTypeConverters of DefaultCamelContext is deprecated.

 I notice that when this option is enabled by default, it is loading 181
 TypeConverters by default. Does this mean 181 classes (including
 inner/anonymous classes)

 Assuming that this is quite a amount of PermGen space, I have set the
 property to false and tried a try run on my code and it seems to work fine
 (I don't have any custom Type Converters in code).

 Is there any specific reason for doing this ? I ask because it could save
 memory and may prove to be useful after all.

 Regards,
 Kalyan





 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Why-is-lazyLoadTypeConverters-deprecated-tp5732492.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: QueryParam value with (ampersand)

2013-05-14 Thread Claus Ibsen
Hi

You need to add more details before people can help you.

See some points here
http://camel.apache.org/support



On Tue, May 14, 2013 at 2:12 PM, jamalissimo roman.janu...@gmail.com wrote:
 Hi guys,

 I am working on file upload route and when I want to upload file and it's
 name contains  character, then I will get this error:

 java.lang.ArrayIndexOutOfBoundsException: 1

 Camel awaits certain number of QueryParams which are defined beforehand.
 When it finds  it will detect it as next QueryParam and the array is
 overflown.

 I am reading this file from my machine and it's being uploaded to the
 server. During the upload I use URLDecoder for other special characters. I
 don't know how to tell Camel that it is only a string

 -Thanks

 Roman



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/QueryParam-value-with-ampersand-tp5732487.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How to persist data from aggregator?

2013-05-14 Thread RTernier
works perfectly! Thanks Claus. Didn't realize the splitter had that built in.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-persist-data-from-aggregator-tp5732421p5732512.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Making a route depend on multiple criteria

2013-05-14 Thread cwhistler
I need a way to create a Camel route that uses a file from endpoint but
cannot start processing that file until some other things are complete.  So
here's a simplified scenario just to provide an example:

A camel route extracts data from a database and writes the records to a file
on the file system.

A second camel route has a file endpoint watching for the extract file. 
When it is available it will transform the records in that file and write
out a new file.  The original file will be moved to a hold folder.

A third route watches for the transformed file to do something with it,
maybe send it off the system somewhere.  When this one is done it will move
the file to a done folder.

A fourth route needs to process the hold file from the second route, but
it cannot process this file until the transformed file has moved to the
done folder.  So is there a way to make this fourth route dependent on
both the hold and the done files?  It does not have to process the
done file, it just can't do anything with the hold file until the third
route is done.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: bind programmatically

2013-05-14 Thread Jean Francois LE BESCONT
Thanks ( like always :) Claus !

It is right that it is a little bit unusual, I have to modify a CSV and add
one new field which is the original field.

the code is :

from(file://C:/Temp/camel/rep1/?noop=true)
   .split().tokenize(\n)
   .streaming()
   .unmarshal()
   .bindy(BindyType.Csv, Ticket.class)
   .process(new Processor() {
  public void process(Exchange exchange) throws Exception {
 Ticket ticket = (Ticket) exchange.getIn().getBody() ;
 BindyCsvDataFormat bindyCsvDataFormat = new
BindyCsvDataFormat(Ticket.class);
 MyOutputStream myOutputStream =new MyOutputStream();
 bindyCsvDataFormat.marshal(exchange, ticket, myOutputStream);
 String s = new String(myOutputStream.toByteArray());
 System.out.println(s);
  }
  })
  .end()
.end()
;

with a custom outstream which keep in memory the conversion.

Thanks

JF


2013/5/14 Claus Ibsen claus.ib...@gmail.com

 From your processor you can just create the bindy data format and
 invoke the marshal method.

 eg add camel-bindy to your class path, and find the BindyDataFormat
 class and create a new instance, configure it, and invoke the marshal
 method manually.

 Its a bit unusual to do it like that, but you can do it.

 On Tue, May 14, 2013 at 4:02 PM, Jean Francois LE BESCONT
 jflebesc...@gmail.com wrote:
  Hey !
 
  I would like to programmatically marshal and bind my body to do :
 
  from(file://C:/Temp/camel/rep1/?noop=true)
 .split().tokenize(\n)
 .unmarshal()
 .bindy(BindyType.Csv, Ticket.class)
 .process(new Processor() {
public void process(Exchange exchange) throws Exception {
   Ticket ticket = (Ticket) exchange.getIn().getBody() ;
 
   // Convert from ticket to CSV which is @CsvRecord
   String or byte[] ticketInCSVOrignal =???  ( ticket )
   ticket.originalVersion =  ticketInCSVOrignal
 
   // modify ticket start here
}
 })
 [...]
 
 
  Something that will do the equivalent of  :
 
  .marshal()
  .bindy(BindyType.Csv, Ticket.class)
 
 
 
  I have look typeConverter and dataformat, but I am a little bit lost
 
  Any idea ?
 
  Thanks !
 
  Jeff



 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen



Re: Using camel-servlet with Multipart - unable to fetch the file

2013-05-14 Thread crmanoj
This is resolved by using/parsing the input stream from camel body instead of
using the HttpServletRequest from camel Headers.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-camel-servlet-with-Multipart-unable-to-fetch-the-file-tp5732204p5732534.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Why dead letter channel doesn't work after adding Processor to onException?

2013-05-14 Thread rafaljaw
Hi all,

I have simple route that takes messages from [Input] and forwards them to
[Output], or to [Failed] (dead letter queue) if something bad happens:

errorHandler(deadLetterChannel(jms:queue:Failed)
.maximumRedeliveries(1)
.redeliveryDelay(0));

onException(Throwable.class)
.maximumRedeliveries(0)
.handled(true);

from(jms:queue:Input)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println(Processing msg  +
exchange.getIn().getBody());
throw new RuntimeException(Something bad happens here...);
}
})
.to(jms:queue:Output);

Everything works as expected - all messages are placed on [Failed] queue
since we are throwing RuntimeException in processor. But it doesn't work
after adding processor to onException:


errorHandler(deadLetterChannel(jms:queue:Failed)
.maximumRedeliveries(1)
.redeliveryDelay(0));

onException(Throwable.class)
.maximumRedeliveries(0)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println(Exception is intercepted...);
}
})
.handled(true);

from(jms:queue:Input)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println(Processing msg  +
exchange.getIn().getBody());
throw new RuntimeException(Something bad happens here...);
}
})
.to(jms:queue:Output);

I'm loosing all messages now - why? Why adding processor to onException is
so special?
I'm using Camel 2.6 and ActiveMQ 5.8.0.

Regards,
Rafal



--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-dead-letter-channel-doesn-t-work-after-adding-Processor-to-onException-tp5732535.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to create a generic SOAP consumer?

2013-05-14 Thread Smith-John
Will someone please help me?



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732538.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Why do Camel core methods still throw Checked Exceptions (everyone agrees they're 'bad' now, right?)

2013-05-14 Thread Christian Müller
Hi pmcb55!

I would like to understand what your issue is with the checked exception in
the Processors process method. As a Camel user, you may derive from
Processor and implement your custom business code in the process method. By
declaring throws Exception on this method, you are free to throw any
exception you want. And, in contrast the the Hibernate case, you don't deal
directly with this exception (declaring it in your code, try/catch the
exception, ...).
You only deal with it if you declare an onException() or doTry()/doCatch()
block which is totally optional - even if it's a checked or unchecked
exception.

If you don't like it, you can also implement your business logic in a bean
which doesn't implement or extend a Camel interface/class and use the
camel-bean component [1] to invoke this bean. Here you are free to only
throw unchecked exceptions.

So, whats the nasty thing for you? I didn't get it...

[1] http://camel.apache.org/bean.html

Best,
Christian


On Sun, May 12, 2013 at 1:17 PM, pmcb55 mcbenne...@dnb.com wrote:

 I've been using Camel for a while (and it's great), but one issue bugs me -
 many of the methods in the core Camel interfaces throw Checked Exceptions,
 e.g. the fundamental 'void process(Exchange exchange) *throws Exception*;',
 or CamelContext methods, like 'addRoutes()' or 'start()'.

 Doesn't the Java world now pretty-much accept that Checked Exceptions are
 generally bad, isn't this debate over
 (
 http://jyops.blogspot.ie/2012/03/why-should-you-use-unchecked-exceptions.html)
 ?!

 Hibernate already made the decision to drop Checked Exceptions:

 http://stackoverflow.com/questions/4609870/why-hibernate-changed-hibernateexception-to-runtimeexception-unchecked
 ,
 and isn't Camel in the same class of 'thing' as Hibernate - i.e. a very
 widely used Java developer framework.

 Does the Camel community still think they are 'good'? I don't! Maybe it's
 just that a change would be backward-compatibility-breaking, and maybe it's
 on the cards for Camel 3.0 - so I'm just asking (I couldn't find anything
 searching this site).

 So rather than expose these nasty Checked Exceptions to my code (because
 they tend to ripple up, or I have stupid try{}/catch(Exception){}' blocks
 in
 my code, I'm considering wrapping *all* the Camel calls (that my code uses)
 in methods that just catch these 'Exceptions' and throw 'RuntimeExceptions'
 instead.

 PMD already has a warning about signatures using 'throws Exception':
 SignatureDeclareThrowsException (so Camel falls down there already!), but
 even my wrapper code will get caught out by the related PMD warning of
 AvoidCatchingGenericException
 (http://pmd.sourceforge.net/pmd-4.2.6/rules/strictexception.html).

 Wouldn't all this nastiness go away if Camel went the Hibernate route (and
 the wider industry route!?) and just dropped Checked Exceptions...? Is
 there
 any general community advice for current Camel 2.x users (e.g. just wrap
 the
 'offending' methods if you don't like them!)??

 And I'm really just asking the question here - there's no need for a
 Checked/Unchecked debate. If the Camel community (or just the committers)
 consider the current situation appropriate then I'm perfectly fine with
 that, and I'll just go with the wrapper methods for my systems.

 Pat.




 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Why-do-Camel-core-methods-still-throw-Checked-Exceptions-everyone-agrees-they-re-bad-now-right-tp5732364.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



How do I determine which endpoint validation exception came from?

2013-05-14 Thread toomanyedwards
Hi all,
  I'm relatively new to camel.  I have a route where I need to do validation
twice (once on the initial input and the then after processing).  I have a
SchemaValidationException handler defined which catches validation errors. 
My question is what is the best practice to determine which end point (that
is which of my validation steps) actually caused the validation exception? I
want to handle it differently if there were errors on the initial input to
my route vs a schema validation after processing. 

-edward



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-do-I-determine-which-endpoint-validation-exception-came-from-tp5732536.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to create a generic SOAP consumer?

2013-05-14 Thread Willem jiang
Hi,

It looks like you are deploying the camel route into OSGi container?
The warning means there are more than on javax.xml.ws.WebServiceProvider 
classes are loaded by deferent Classloader.
Are you using Karaf or ServiceMix?


--  
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 Saturday, May 11, 2013 at 6:21 PM, Smith-John wrote:

 Hi,
  
 my route now looks like this:
 from(cxf:http://localhost:8050/service?dataFormat=PAYLOAD;)...
 (PAYLOAD mode without wsdl and serviceClass).
  
 But with this I get a NullPointer exception where I add the route to the
 CamelContext (camelContext.addRoutes(new GenericSOAPRoute());).
  
 Don't know if it helps, but LOG says:
  
 12:08:27.575 DEBUG o.a.c.core.osgi.OsgiDefaultCamelContext:1985 Warming
 up route id: route3 having autoStartup=true
 12:08:27.575 TRACE org.apache.camel.support.ServiceSupport:54 Service
 already started
 12:08:27.575 DEBUG org.apache.camel.impl.RouteService:129 Starting
 services on route: route3
 12:08:27.591 DEBUG o.apache.camel.component.cxf.CxfEndpoint:279 Ignore
 DataFormat mode PAYLOAD since SEI class is annotated with WebServiceProvider
 12:08:27.591 DEBUG o.apache.camel.component.cxf.CxfEndpoint:307  
 ServerFactoryBean: org.apache.cxf.jaxws.JaxWsServerFactoryBean@1a0283e added
 properties: {}
 12:08:27.607 DEBUG o.apache.camel.component.cxf.CxfEndpoint:740 Using
 DefaultBus org.apache.cxf.bus.extension.ExtensionManagerBus@eeabe8
 11.05.2013 12:08:27 org.apache.cxf.jaxws.support.JaxWsImplementorInfo
 getWebServiceProviderAnnotation
 WARNUNG: The javax.xml.ws.WebServiceProvider annotation was already loaded
 by another classloader. Please check if there are multiple versions of the
 web service annotation jar in your classpath.
 12:08:27.622 INFO o.a.c.core.osgi.OsgiDefaultCamelContext:1590 Apache
 Camel 2.10.4 (CamelContext: 101-camel-6) is shutting down
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:111 Stopping
 service org.apache.camel.impl.RouteService@16c14c0
 12:08:27.622 TRACE o.a.c.m.DefaultManagementLifecycleStrategy:541 The
 route is not managed:
 EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 -
 Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
 12:08:27.622 DEBUG org.apache.camel.impl.RouteService:197 Stopping
 services on route: route3
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:111 Stopping
 service
 EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 -
 Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:186 Shutting
 down service:
 EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 -
 Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
 12:08:27.622 TRACE org.apache.camel.support.ServiceSupport:82 Service
 already stopped
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:163 Shutting
 down service org.apache.camel.impl.RouteService@16c14c0
 12:08:27.622 DEBUG org.apache.camel.impl.RouteService:240 Shutting
 down services on route: route3
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:106 Service
 already stopped:
 EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 -
 Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:186 Shutting
 down service:
 EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 -
 Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
 12:08:27.622 TRACE org.apache.camel.support.ServiceSupport:149 Service
 already shut down
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:111 Stopping
 service Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:186 Shutting
 down service:
 Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 12:08:27.622 TRACE org.apache.camel.support.ServiceSupport:82 Service
 already stopped
 12:08:27.622 TRACE o.a.c.m.DefaultManagementLifecycleStrategy:541 The
 route is not managed:
 EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
 -
 Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732332.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Using camel-servlet with Multipart - unable to fetch the file

2013-05-14 Thread Willem jiang
camel will try to digest the HttpServletRequest and setup the message headers 
and body.
It's a common practice to consume the input stream from message body :)  


--  
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, May 15, 2013 at 4:47 AM, crmanoj wrote:

 This is resolved by using/parsing the input stream from camel body instead of
 using the HttpServletRequest from camel Headers.
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Using-camel-servlet-with-Multipart-unable-to-fetch-the-file-tp5732204p5732534.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Making a route depend on multiple criteria

2013-05-14 Thread kalyan
I'm a newbie here. But what ever you described may be handled with multiple
routes. Use direct: for synchronous and seda: for asynchronous routing
as described in documentation for joining all the routes you create.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515p5732517.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Steps to replace a direct call by a JMS proxy?

2013-05-14 Thread Al Ferguson
Got it, thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Steps-to-replace-a-direct-call-by-a-JMS-proxy-tp5732430p5732516.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: JAXB Interface Issue

2013-05-14 Thread Willem jiang
Hi,  
I just found you are using equinox container.  
You can either put the jar into JDK endorse directory, or hack the properties 
file to make sure the com.sun.xml.internal.bind packages are not exported.


--  
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, May 15, 2013 at 1:53 AM, Claus Ibsen wrote:

 Hi
  
 You can possible add jaxb-impl JAR to the classpath so you can control
 which JAXB impl is in use.
 The ones from the JDK is sometimes outdated and buggy.
  
  
  
 On Tue, May 14, 2013 at 5:04 PM, David Carver dcar...@intalio.com 
 (mailto:dcar...@intalio.com) wrote:
  With Open JDK 7 we have been getting some odd issues lately when running
  camel in an equinox container. The following is the stack trace we get:
   
  org.springframework.beans.factory.config.BeanPostProcessor is an interface,
  and JAXB can't handle interfaces.
  this problem is related to the following location:
  at org.springframework.beans.factory.config.BeanPostProcessor
  at public org.springframework.beans.factory.config.BeanPostProcessor
  org.apache.camel.spring.CamelContextFactoryBean.getBeanPostProcessor()
  at org.apache.camel.spring.CamelContextFactoryBean
   
  at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:212)
  ~[jaxb-api_2.2.7.jar:na]
  at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
  ~[jaxb-api_2.2.7.jar:na]
  ... 159 common frames omitted
  Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:
  39 counts of IllegalAnnotationExceptions
  at
  com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
  ~[na:1.7.0_21]
  at
  com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451)
  ~[na:1.7.0_21]
  at
  com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java:283)
  ~[na:1.7.0_21]
  at
  com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java:126)
  ~[na:1.7.0_21]
  at
  com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148)
  ~[na:1.7.0_21]
  at
  com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:130)
  ~[na:1.7.0_21]
  at
  com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:221)
  ~[na:1.7.0_21]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ~[na:1.7.0_21]
  at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  ~[na:1.7.0_21]
  at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  ~[na:1.7.0_21]
  at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21]
  at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
  ~[jaxb-api_2.2.7.jar:na]
  ... 160 common frames omitted
   
  This is running with springframework 3.1.2. I'm running out of ideas as to
  what can cause this issue as the JAXB implementation is being brough in from
  the jdk. Anybody else seen this issue?
   
  Dave
  
  
  
 --  
 Claus Ibsen
 -
 www.camelone.org (http://www.camelone.org): The open source integration 
 conference.
  
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com (mailto:cib...@redhat.com)
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen





Problem from Java DSL to Spring DSL

2013-05-14 Thread Gary Liu
Hello,

I am trying to translate the following Java DSL (This is the example from
2.10.4). The Java DSL works fine. But I after I translate to Spring DSL,
several things are not working as expected. Would someone please help?
Java DSL===
from(cxf:bean:reportIncident)
.convertBodyTo(InputReportIncident.class)
.setHeader(Exchange.FILE_NAME,
constant(request-${date:now:-MM-dd-HHmmssSSS}))
.wireTap(file://target/inbox/)
.choice().when(simple(${body.givenName} == 'Claus'))
.transform(constant(ok))
.otherwise()
.bean(new ReportIncidentImpl(), doReportIncident)
.transform(constant(accepted)

);

===SPRING DSL===
camel:camelContext id=camel


camel:route
camel:from uri=cxf:bean:reportIncident /
camel:convertBodyTo
type=org.apache.camel.example.reportincident.InputReportIncident /
camel:setHeader headerName=${Exchange.FILE_NAME}

camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant
/camel:setHeader
camel:wireTap 
uri=file://target/inbox//camel:wireTap
camel:choice
camel:when
camel:simple${body.givenName} == 
'Claus'/camel:simple
camel:transform

camel:constantOK/camel:constant
/camel:transform
/camel:when
camel:otherwise
camel:transform

camel:constantAccepted/camel:constant
/camel:transform
/camel:otherwise
/camel:choice
/camel:route
/camel:camelContext
===

Here are the things I did not translate propertly:

   .choice().when(simple(${body.givenName} == 'Claus'))
.transform(constant(ok))
 
NOT THE SAME AS:
camel:choice
camel:when
camel:simple${body.givenName} == 
'Claus'/camel:simple
camel:transform

camel:constantOK/camel:constant
/camel:transform
/camel:when


.setHeader(Exchange.FILE_NAME,
constant(request-${date:now:-MM-dd-HHmmssSSS}))

NOT THE SAME AS:

camel:setHeader headerName=${Exchange.FILE_NAME}

camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}

Thanks,
--Gary




--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem from Java DSL to Spring DSL

2013-05-14 Thread Willem jiang
Hi,

I think you cannot use the constant of Exchange.FILE_NAME directly in the 
Spring DSL.
You should use the String directly like this  
camel:setHeader headerName=CamelFileName/
camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant


--  
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, May 15, 2013 at 10:40 AM, Gary Liu wrote:

 Hello,
  
 I am trying to translate the following Java DSL (This is the example from
 2.10.4). The Java DSL works fine. But I after I translate to Spring DSL,
 several things are not working as expected. Would someone please help?
 Java DSL===
 from(cxf:bean:reportIncident)
 .convertBodyTo(InputReportIncident.class)
 .setHeader(Exchange.FILE_NAME,
 constant(request-${date:now:-MM-dd-HHmmssSSS}))
 .wireTap(file://target/inbox/)
 .choice().when(simple(${body.givenName} == 'Claus'))
 .transform(constant(ok))
 .otherwise()
 .bean(new ReportIncidentImpl(), doReportIncident)
 .transform(constant(accepted)
  
 );
  
 ===SPRING DSL===
 camel:camelContext id=camel
  
  
 camel:route
 camel:from uri=cxf:bean:reportIncident /
 camel:convertBodyTo
 type=org.apache.camel.example.reportincident.InputReportIncident /
 camel:setHeader headerName=${Exchange.FILE_NAME}
  
 camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant
 /camel:setHeader
 camel:wireTap uri=file://target/inbox//camel:wireTap
 camel:choice
 camel:when
 camel:simple${body.givenName} == 'Claus'/camel:simple
 camel:transform
 camel:constantOK/camel:constant
 /camel:transform
 /camel:when
 camel:otherwise
 camel:transform
 camel:constantAccepted/camel:constant
 /camel:transform
 /camel:otherwise
 /camel:choice
 /camel:route
 /camel:camelContext
 ===
  
 Here are the things I did not translate propertly:
  
 .choice().when(simple(${body.givenName} == 'Claus'))
 .transform(constant(ok))
  
 NOT THE SAME AS:
 camel:choice
 camel:when
 camel:simple${body.givenName} == 'Claus'/camel:simple
 camel:transform
 camel:constantOK/camel:constant
 /camel:transform
 /camel:when
  
  
 .setHeader(Exchange.FILE_NAME,
 constant(request-${date:now:-MM-dd-HHmmssSSS}))
  
 NOT THE SAME AS:
  
 camel:setHeader headerName=${Exchange.FILE_NAME}
 camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}
  
 Thanks,
 --Gary
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Problem from Java DSL to Spring DSL

2013-05-14 Thread Gary Liu
When I test using soupUI with the following input:
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:rep=http://reportincident.example.camel.apache.org;
   soapenv:Header/
   soapenv:Body
  rep:inputReportIncident
 incidentId111/incidentId
 incidentDate2013-05-09/incidentDate
 givenNameClaus/givenName
 familyNameMuller/familyName
 summarybla/summary
 detailsbla/details
 g...@vha.com
 phone678-447-2399/phone
  /rep:inputReportIncident
   /soapenv:Body
/soapenv:Envelope


I got Response:

soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;
   soap:Body
  soap:Fault
 faultcodesoap:Server/faultcode
 faultstringPart
{http://reportincident.example.camel.apache.org}out should be of type
org.apache.camel.example.reportincident.OutputReportIncident, not
java.lang.String/faultstring
  /soap:Fault
   /soap:Body
/soap:Envelope






--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558p5732559.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Sharing a solution for discussion

2013-05-14 Thread wagnermarques
Hello camel riders,

I would like to share a solution and ask if it was the best aproach. 
I think it can be util for some one in the future and because is a
interesting example of integration using camel!


The use case:
I have a orbeon forms installed that was configured to: 1) save the form
date to existdb and 2) after it, send metadata of the form to my camel route
described below. With the camel route, with the metadate of the form
submited (using camel-http) the route interact with existdb rest api to get
the real date of the form.


Ok, it is a simplification of the use case, because next step is improve it
with business rules upon form metadata and start a business process deployed
in apache ode. But start the process from the route is not implemented yet
and not described here.


That is the code (sorry for much comments)


?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:cxf=http://camel.apache.org/schema/cxf;
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://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd;


cxf:rsServer id=rsRestServices_OrbeonServer
address=http://localhost:18181/orbeonservice;
serviceClass=br.edu.fzlbpms.service.orbeon.ControllerService 
/


camelContext xmlns=http://camel.apache.org/schema/spring;
route 
id=FZLBPMS_CAMEL_ROUTE___cxfrs_bean_rsRestServices_OrbeonServer
from uri=cxfrs:bean:rsRestServices_OrbeonServer /


setBody
constant/constant
   /setBody

to 
uri=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR/


 setHeader headerName=CamelHttpUri
simple
http://localhost:8282/exist/rest/db/orbeon/fr/${header.fzlbpms_orbeon_app}/${header.fzlbpms_orbeon_form}/data/${header.fzlbpms_orbeon_dataId}/data.xml?bridgeEndpoint=true
 /simple
 /setHeader

 
   inOut uri=http://doesnt.matter.we/override/it/anyways; 
/  
/route
/camelContext



bean id=messageInspectProcessor
class=br.edu.fzlbpms.service.orbeon.MessageInspectProcessor /

bean id=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR

class=br.edu.fzlbpms.service.orbeon.Pega_dados_do_formularioPROCESSOR /

bean id=BuildResponseProcessor
class=br.edu.fzlbpms.service.orbeon.BuildResponseProcessor /

/beans



This processor is important to distinct what data is camming from witch form
by filling the values of the headers:
${header.fzlbpms_orbeon_app}
${header.fzlbpms_orbeon_form}
${header.fzlbpms_orbeon_dataId}

public class Pega_dados_do_formularioPROCESSOR implements Processor{

public void process(Exchange exchange) throws Exception {

String camelHttpQuery =
(String)exchange.getIn().getHeader(CamelHttpQuery);


//app=existappform=existappform1document=c757e862848cf9cc2e170d9325a1fc94c282a8e4
String[] split = camelHttpQuery.split();


//app=existapp
String[] appParam = split[0].split(=);
String app = appParam[1];


String[] formParam = split[1].split(=);
String form = formParam[1];

String[] dataParam = split[2].split(=);
String dataId = dataParam[1];


System.out.println(\n\n);
System.out.println(app);
System.out.println(form);
System.out.println(dataId);

exchange.getIn().setHeader(fzlbpms_orbeon_app, app);
exchange.getIn().setHeader(fzlbpms_orbeon_form, form);
exchange.getIn().setHeader(fzlbpms_orbeon_dataId, dataId);

}

}



I still have several problems and doubts, like basic autentications for
example, but for now I just would like to share and to ask about if it was a
good aproach of this kind of integration (if it is relevant in some sense).

Thanks,







--
View this message in context: 
http://camel.465427.n5.nabble.com/Sharing-a-solution-for-discussion-tp5732560.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Sharing a solution for discussion

2013-05-14 Thread Willem jiang
Hi,

I'm not sure why you chose camel-cxfrs component to accept the request.
If you just want to process the form, you can use the camel-jetty or 
camel-servlet directly.
It could be more easy to add the basic autentications supports out of box.


--  
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, May 15, 2013 at 11:03 AM, wagnermarques wrote:

 Hello camel riders,
  
 I would like to share a solution and ask if it was the best aproach.  
 I think it can be util for some one in the future and because is a
 interesting example of integration using camel!
  
  
 The use case:
 I have a orbeon forms installed that was configured to: 1) save the form
 date to existdb and 2) after it, send metadata of the form to my camel route
 described below. With the camel route, with the metadate of the form
 submited (using camel-http) the route interact with existdb rest api to get
 the real date of the form.
  
  
 Ok, it is a simplification of the use case, because next step is improve it
 with business rules upon form metadata and start a business process deployed
 in apache ode. But start the process from the route is not implemented yet
 and not described here.
  
  
 That is the code (sorry for much comments)
  
  
 ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:cxf=http://camel.apache.org/schema/cxf;
 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://camel.apache.org/schema/cxf
 http://camel.apache.org/schema/cxf/camel-cxf.xsd;
  
  
 cxf:rsServer id=rsRestServices_OrbeonServer
 address=http://localhost:18181/orbeonservice;
 serviceClass=br.edu.fzlbpms.service.orbeon.ControllerService /
  
 camelContext xmlns=http://camel.apache.org/schema/spring;
 route id=FZLBPMS_CAMEL_ROUTE___cxfrs_bean_rsRestServices_OrbeonServer
 from uri=cxfrs:bean:rsRestServices_OrbeonServer /
  
  
 setBody
 constant/constant
 /setBody
  
 to uri=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR/
  
  
 setHeader headerName=CamelHttpUri
 simple
 http://localhost:8282/exist/rest/db/orbeon/fr/${header.fzlbpms_orbeon_app}/${header.fzlbpms_orbeon_form}/data/${header.fzlbpms_orbeon_dataId}/data.xml?bridgeEndpoint=true
 /simple
 /setHeader  
  
  
 inOut uri=http://doesnt.matter.we/override/it/anyways; /  
 /route
 /camelContext
  
  
  
 bean id=messageInspectProcessor
 class=br.edu.fzlbpms.service.orbeon.MessageInspectProcessor /
  
 bean id=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR
 class=br.edu.fzlbpms.service.orbeon.Pega_dados_do_formularioPROCESSOR /
  
 bean id=BuildResponseProcessor
 class=br.edu.fzlbpms.service.orbeon.BuildResponseProcessor /
  
 /beans
  
  
  
 This processor is important to distinct what data is camming from witch form
 by filling the values of the headers:
 ${header.fzlbpms_orbeon_app}
 ${header.fzlbpms_orbeon_form}
 ${header.fzlbpms_orbeon_dataId}
  
 public class Pega_dados_do_formularioPROCESSOR implements Processor{
  
 public void process(Exchange exchange) throws Exception {
  
 String camelHttpQuery =
 (String)exchange.getIn().getHeader(CamelHttpQuery);
  
  
 //app=existappform=existappform1document=c757e862848cf9cc2e170d9325a1fc94c282a8e4
 String[] split = camelHttpQuery.split();
  
  
 //app=existapp
 String[] appParam = split[0].split(=);
 String app = appParam[1];
  
  
 String[] formParam = split[1].split(=);
 String form = formParam[1];
  
 String[] dataParam = split[2].split(=);
 String dataId = dataParam[1];
  
  
 System.out.println(\n\n);
 System.out.println(app);
 System.out.println(form);
 System.out.println(dataId);
  
 exchange.getIn().setHeader(fzlbpms_orbeon_app, app);
 exchange.getIn().setHeader(fzlbpms_orbeon_form, form);
 exchange.getIn().setHeader(fzlbpms_orbeon_dataId, dataId);
  
 }
  
 }
  
  
  
 I still have several problems and doubts, like basic autentications for
 example, but for now I just would like to share and to ask about if it was a
 good aproach of this kind of integration (if it is relevant in some sense).
  
 Thanks,
  
  
  
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Sharing-a-solution-for-discussion-tp5732560.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Problem from Java DSL to Spring DSL

2013-05-14 Thread Gary Liu
OK. I got the set file name part work.

camel:setHeader headerName=CamelFileName

camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant
/camel:setHeader

is equivalent as:

setHeader(Exchange.FILE_NAME,
constant(request-${date:now:-MM-dd-HHmmssSSS}))




--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558p5732562.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem from Java DSL to Spring DSL

2013-05-14 Thread Gary Liu
Thanks William! That works.

Now, my transform part is still not working. Any sugguestions?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558p5732563.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem from Java DSL to Spring DSL

2013-05-14 Thread Willem jiang
Hi,

Can you check if you put the camel-jaxb jar into your class path?  

--  
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, May 15, 2013 at 11:09 AM, Gary Liu wrote:

 Thanks William! That works.
  
 Now, my transform part is still not working. Any sugguestions?
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558p5732563.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Making a route depend on multiple criteria

2013-05-14 Thread boday
sounds like you could just explicitly invoke the 4th route (direct:route4) at
the end of the 3rd route and enrich the 4th route with the hold file...see
http://camel.apache.org/content-enricher.html


cwhistler wrote
 I need a way to create a Camel route that uses a file from endpoint but
 cannot start processing that file until some other things are complete. 
 So here's a simplified scenario just to provide an example:
 
 A camel route extracts data from a database and writes the records to a
 file on the file system.
 
 A second camel route has a file endpoint watching for the extract file. 
 When it is available it will transform the records in that file and write
 out a new file.  The original file will be moved to a hold folder.
 
 A third route watches for the transformed file to do something with it,
 maybe send it off the system somewhere.  When this one is done it will
 move the file to a done folder.
 
 A fourth route needs to process the hold file from the second route, but
 it cannot process this file until the transformed file has moved to the
 done folder.  So is there a way to make this fourth route dependent on
 both the hold and the done files?  It does not have to process the
 done file, it just can't do anything with the hold file until the
 third route is done.





-
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515p5732566.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How do I determine which endpoint validation exception came from?

2013-05-14 Thread boday
you generally can isolate individual exceptions by either throwing/catching
more explicit exceptions or by using granular doTry/doCatch clauses within
routes...

another option is to use the Exchange property
Exchange.TO_ENDPOINT/FAILURE_ENDPOINT to indicate the last endpoint that was
tried before the exception was thrown... 


toomanyedwards wrote
 Hi all,
   I'm relatively new to camel.  I have a route where I need to do
 validation twice (once on the initial input and the then after
 processing).  I have a SchemaValidationException handler defined which
 catches validation errors.  My question is what is the best practice to
 determine which end point (that is which of my validation steps) actually
 caused the validation exception? I want to handle it differently if there
 were errors on the initial input to my route vs a schema validation after
 processing. 
 
 -edward





-
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-do-I-determine-which-endpoint-validation-exception-came-from-tp5732536p5732567.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Streaming a PDF from remote machine

2013-05-14 Thread Chinababu Illa
Thanks Willem.

Regards,
Chinna



--
View this message in context: 
http://camel.465427.n5.nabble.com/Streaming-a-PDF-from-remote-machine-tp5732401p5732571.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to create a generic SOAP consumer?

2013-05-14 Thread Claus Ibsen
On Tue, May 14, 2013 at 11:35 PM, Smith-John mich...@gmail.com wrote:
 Will someone please help me?


If you want to get help faster then check the bottom sections of this page
http://camel.apache.org/support




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732538.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen