Re: Using Bindy for multiple record types in the same file

2013-07-12 Thread lb
You have different options:
1) use Bindy the Willem's way (bear in mind that if you use two data format
classes you have to place them in different top-level packages)
2) use Bean-IO and do something like:

final Predicate predicateOrder   = body().startsWith("01");
final Predicate predicateCustomer = body().startsWith("02");

from("file://tmp")
.split(body(String.class)
.tokenize("\n")).streaming()
.choice()
.when(predicateOrder)
.unmarshal(new
BeanIODataFormat("beanio-mapping.xml","order"))
.to("log:ORDER?level=INFO&showHeaders=false")
.when(predicateCustomer)
.unmarshal(new
BeanIODataFormat("beanio-mapping.xml","customer"))
.to("log:CUSTOMER?level=INFO&showHeaders=false")
.end();

--
lb



On Fri, Jul 12, 2013 at 4:17 AM, Willem jiang wrote:

> I think you can split the file and routing the lines to different bindy
> data format base on the first 2 character.
>
>
> --
> 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 Friday, July 12, 2013 at 2:59 AM, rodrickmusser wrote:
>
> > I am wondering if Bindy can be used in the following scenario:
> >
> > The file format I am working with is fixed length. The first two
> characters
> > indicate the record type. For example, "01" indicates an order record,
> "02"
> > indicates a customer record. If the record is an order record, characters
> > 2-11 are the order id. If the record is a customer record, characters
> 2-20
> > is the customer name.
> >
> > How does Bindy handle this situation?
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Using-Bindy-for-multiple-record-types-in-the-same-file-tp5735541.html
> > Sent from the Camel - Users mailing list archive at Nabble.com (
> http://Nabble.com).
>
>
>
>


CXF SOAP response

2013-07-12 Thread MegaSonik
Hi all!

I've been using Camel in the last 2 weeks, so I'm relatively new into its
usage.

After reading the doc and several howtos, I'm a bit struck in a point, and
I'd like to ask you if I'm doing something wrong.


My Camel route consumes an external SOAP WS in POJO mode and, afterwards,
sends its return value (String) to a JMS topic.
The point is that the ws is returning a String as intended (I've checked
this with a proxy), but my Camel body is a null MessageContentsList.

This is my route:
from("direct:publishFileApi")
.to("cxf://http://localhost:/demo-core-api-impl/FileServiceImpl?dataFormat=POJO&serviceClass=com.demo.core.api.file.FileService";)

And this is the return value from the ws:
http://schemas.xmlsoap.org/soap/envelope/";>

http://file.api.core.demo.com/";>
4028800d3fd1e499013fd1f804a80004





I'd like to know if I have an usage misconception or if I need to configure
something.


Thanks in advance!



--
View this message in context: 
http://camel.465427.n5.nabble.com/CXF-SOAP-response-tp5735566.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: xslt: TransformerException: include href is empty

2013-07-12 Thread per.ce...@gmail.com
Hi again,

Is this problem existing, due to camels own XsltUriResolver?
It seems that camels XsltUriResolver only is capable to handle files 
either from the classpath or the file system. 
With the xlst function, document(''), the xslt processer should be able to
handle that the result "is the source XML of the XSLT document itself".


Should I create a JIRA case for camel? Is there any guidelines how to
proceed?

Regards / Per 



--
View this message in context: 
http://camel.465427.n5.nabble.com/xslt-TransformerException-include-href-is-empty-tp5730288p5735567.html
Sent from the Camel - Users mailing list archive at Nabble.com.


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

2013-07-12 Thread cannykanna
Hi
I am using the camel-cxf example and created a project in eclipse.
In src/main/java 
org.apache.camel.example.Provider package, I created my own Client which
talks to end application.
I used this client in my CamelCxfExample.java Class and modified the tester
bean as well. 
Now I modified the CamelCXFProviderRouteConfig.xml in the same project.

Now when I run   mvn exec:java -PWebServiceProvider command from eclipse, I
am getting below stack of error:
[INFO] Scanning for projects...
[INFO] 
[INFO]

[INFO] Building Camel :: Example :: CXF 2.11.0
[INFO]

[INFO] 
[INFO] >>> exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-cxf
>>>
[INFO] 
[INFO] --- maven-bundle-plugin:2.3.7:cleanVersions (versions) @
camel-example-cxf ---
[INFO] 
[INFO] <<< exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-cxf
<<<
[INFO] 
[INFO] --- exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-cxf
---
[rovider.CamelCxfExample.main()] ClassPathXmlApplicationContext INFO 
Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@6b5b5783:
startup date [Fri Jul 12 12:35:44 IST 2013]; root of context hierarchy
[rovider.CamelCxfExample.main()] XmlBeanDefinitionReaderINFO 
Loading XML bean definitions from class path resource
[META-INF/spring/CamelCXFProviderRouteConfig.xml]
[rovider.CamelCxfExample.main()] XmlBeanDefinitionReaderINFO 
Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
[rovider.CamelCxfExample.main()] ClassPathXmlApplicationContext INFO  Bean
'cxf' of type [class org.apache.cxf.bus.spring.SpringBus] is not eligible
for getting processed by all BeanPostProcessors (for example: not eligible
for auto-proxying)
[rovider.CamelCxfExample.main()] DefaultListableBeanFactory INFO 
Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@3da997a:
defining beans
[bridgePropertyPlaceholder,cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,testBean,soapMessageEndpoint,template,consumerTemplate,test_context:beanPostProcessor,test_context];
root of factory hierarchy
[rovider.CamelCxfExample.main()] CamelContextFactoryBeanINFO 
Bridging Camel and Spring property placeholder configurer with id:
bridgePropertyPlaceholder
[rovider.CamelCxfExample.main()] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: test_context) is starting
[rovider.CamelCxfExample.main()] ManagementStrategyFactory  INFO  JMX
enabled.
[rovider.CamelCxfExample.main()] DefaultTypeConverter   INFO  Loaded
196 type converters
[rovider.CamelCxfExample.main()] ReflectionServiceFactoryBean   INFO 
Creating Service {http://www.service-now.com/incident}ServiceNow_incident
from WSDL: wsdl/incident.do.wsdl
[rovider.CamelCxfExample.main()] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: test_context) is shutting down
[rovider.CamelCxfExample.main()] SpringCamelContext INFO  Uptime
0.898 seconds
[rovider.CamelCxfExample.main()] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: test_context) is shutdown in 0.004 seconds
Get the exception org.apache.camel.RuntimeCamelException:
java.lang.RuntimeException: Protocol mismatch for port 443: engine's
protocol is http, the url protocol is https

My endpoint application runs on https protocol.

Can you please help me.?



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


Re: CSV files processing

2013-07-12 Thread Jothi
I'm considering the Bindy component to marshall and unmarshall stuff. I can
see that there is a OneToMany annotation that I can use. Will the OneToMany
only map to a List or can I use a Set as well?



--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-files-processing-tp5735470p5735569.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CSV files processing

2013-07-12 Thread Jothi
I have a Bindy bean written as below:

public class ObjectMaster {

private String field1;

@OneToMany
private List < Object1 > field2;

@OneToMany
private List < Object2 > field3;
}

I have two CSV files in which unmarshalling one of them would produce a one
to many relationship with ObjectMaster and Object1 and the other CSV file
will produce the one to many relationship with ObjectMaster and Object2. Is
this possible with the camel bindy?

Regards,
Joe 




--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-files-processing-tp5735470p5735570.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using Bindy for multiple record types in the same file

2013-07-12 Thread rodrickmusser
Thanks for the great responses.  They are very helpful.

After discovering more about the problem domain, it appears that our clients
do not always adhere to the file format.  For example, in a standard file,
positions 10-20 may represent the account number.  Client 1 sends files that
adhere to this standard.  Client 2 sends a file where positions 10-20
represent the account's creation date.  Client 3 sends a file where
positions 10-20 represent a comment about the account.  (So why they even
bother defining a file format standard is beyond me.)  We need to configure
these changes after the software is deployed.  So, I think this precludes me
from using an annotation driven mapping.  Which is unfortunate, because
Bindy looks like a great framework to use.

I'm debating between using Bean-IO where, as I understand it, the mapping is
defined in an xml file, or building something myself.  If I go with Bean-IO,
and we get a client who doesn't exactly adhere to the standard, I can create
a special xml mapping just for that client.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Bindy-for-multiple-record-types-in-the-same-file-tp5735541p5735578.html
Sent from the Camel - Users mailing list archive at Nabble.com.


onException with redeliveryPolicyRef not working

2013-07-12 Thread swwyatt
Hi,

I have a route with an onException that references a spring bean redelivery
policy. It appears that the reference is not working as I have a
maximumRetries set but no retries are attempted. If I use the onException
with a child element  it works
fine.

Does anyone know how to make this work?

V2.8.1











java.lang.Exception

false


  




--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-with-redeliveryPolicyRef-not-working-tp5735579.html
Sent from the Camel - Users mailing list archive at Nabble.com.


REST best practices

2013-07-12 Thread humayun0156
i'm new in camel. i want to design a camel application which sync two
servers. 
server1:
this server send a message to camel application. this message has a HTTP
link which we should download and this downloaded message has another
multiple HTTP link which we should download by HTTP GET request and so on.
Now we aggregate all the downloaded things and send it to server2 HTTP post
request and from the response of post request we should modify some of
server1 resource by PUT request.

so my question is which component should i use in this scenario which
support dynamically picked HTTP uri?

Thanks in advance.



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


Re: Error in camel-bindy

2013-07-12 Thread Jothi
After a bit of fiddling with it, I had to give up on the bindy component as
it does not fit to what I have. My domain model consist of a parent class
and a sub class where some of the fields are annotated in the parent class.
But this leads to an error when used with the bindy component. So this does
not fit my needs. Had to give up on the bindy component.

Regards,
Joe



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


Re: Error in camel-bindy

2013-07-12 Thread Jothi
I tried using version 2.9.x, but that seems not to be feasible as all the
other modules use 2.8.0 and I get dependency path initialization errors when
it is trying to resolve the camel core libraries. Is there another way to
get around this issue? 

Regards,
Joe



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


Re: Error in camel-bindy

2013-07-12 Thread Jothi
I can now see that it is fixed in versions 2.8.2 and above. But this brings
me another question. Even though I use Camel 2.8.0, can I use version 2.9.0
for the bindy component?



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


Error in camel-bindy

2013-07-12 Thread Jothi
Guys,

I face a strange error when trying to use the camel-bindy component!

The separator has not been defined in the annotation @CsvRecord or not
instantiated during initModel. 

I have specified this in the annotation. I checked the old posts by doing a
simple search and I came to know that this was fixed in Camel 2.7. I use the
version 2.8.0.fuse-01-06. Is there a bug still unfixed or un ported to the
version that I'm using?

Regards,
Joe



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


Re: Error in camel-bindy

2013-07-12 Thread Jothi
This is what I do to initialize the bindy component!

DataFormat bindy = new BindyCsvDataFormat("com.test.mypackage.csvdata");

The package contains the classes that are annotated with the @CsvRecord
annotation. The package also contains some other classes that do not have
this annotation. But I guess this should not be a problem.

Regards,
Joe



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


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

2013-07-12 Thread salemi
Yep, I was thinking about this approach as well.  
Using Seda is the transnational integrity preserved? 
Let say the delivery of one message using seda fails, does camel recognize
it and redeliver it?





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


Bean Method Invocation regression in 2.11

2013-07-12 Thread Ashwin Pejavar
I'm testing my upgrade to 2.11 and noticed a bug in how beanMethod
invocations are parsed. 

I'm using Spring to define my routes.

The following invocation expression: exec(*, '', 'arg3') gets parsed as
arg1: *
arg2: ""
arg3: ",arg3" (notice the comma).

I tracked down the bug to the class org.apache.camel.util.StringQuoteHelper.
The code-block
} else if (ch == separator) {
// add as answer if we are not in a quote
if (!singleQuoted && !doubleQuoted && sb.length() > 0) {
String text = sb.toString();
if (trim) {
text = text.trim();
}
answer.add(text);
sb.setLength(0);
continue;
}
}

Should instead be
} else if (ch == separator) {
// add as answer if we are not in a quote
if (!singleQuoted && !doubleQuoted) {
if (sb.length() > 0) {
String text = sb.toString();
if (trim) {
text = text.trim();
}
answer.add(text);
sb.setLength(0);
}
continue; //always skip separator if not in quotes
}
}



--
View this message in context: 
http://camel.465427.n5.nabble.com/Bean-Method-Invocation-regression-in-2-11-tp5735576.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Bean Method Invocation regression in 2.11

2013-07-12 Thread Willem jiang
Hi,
Thanks for reporting this.
I just filled a JIRA[1] for it.

[1]https://issues.apache.org/jira/browse/CAMEL-6544  

--  
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, July 13, 2013 at 1:27 AM, Ashwin Pejavar wrote:

> I'm testing my upgrade to 2.11 and noticed a bug in how beanMethod
> invocations are parsed.  
>  
> I'm using Spring to define my routes.
>  
> The following invocation expression: exec(*, '', 'arg3') gets parsed as
> arg1: *
> arg2: ""
> arg3: ",arg3" (notice the comma).
>  
> I tracked down the bug to the class org.apache.camel.util.StringQuoteHelper.
> The code-block
> } else if (ch == separator) {
> // add as answer if we are not in a quote
> if (!singleQuoted && !doubleQuoted && sb.length() > 0) {
> String text = sb.toString();
> if (trim) {
> text = text.trim();
> }
> answer.add(text);
> sb.setLength(0);
> continue;
> }
> }
>  
> Should instead be
> } else if (ch == separator) {
> // add as answer if we are not in a quote
> if (!singleQuoted && !doubleQuoted) {
> if (sb.length() > 0) {
> String text = sb.toString();
> if (trim) {
> text = text.trim();
> }
> answer.add(text);
> sb.setLength(0);
> }
> continue; //always skip separator if not in quotes
> }
> }
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Bean-Method-Invocation-regression-in-2-11-tp5735576.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





OneToMany in camel-bindy

2013-07-12 Thread Jothi
Guys,

Is this OneToMany a true OneToMany? I guess it only applies when the entire
CSV file has some common elements? I have a file that has entries like
below:

1,abc,def,joe
1,abc,xyz,san
2,abc,mno,ram
3,abc,fgh,sam

When I tried with the above file which used the OneToMany annotation between
the Id and the rest of the fields, it threw an error saying that pos 2 must
be defined. I later took a look into the Camel documentation for bindy and
realized that the id's should all be the same throught the CSV file.

Can we model the OneToMany in such a way that it takes a parameter for the
position and uses this to identify which field will be the One side?
Something like:

OneToMany(pos=1)

Is it reasonable enough to raise a Jira and provide a fix. I would be happy
to provide a fix.

Regards,
Joe



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