Endpoint configuration error

2013-02-27 Thread Richa
Hi,
I am creating a JmsEndpoint for my route. The problem is that when the JMS
is down, the following line: 
JmsEndpoint
endpoint=(JmsEndpoint)getContext().getEndpoint("activemq:topic:jms.topicName"
is throwing exception.
I have put this line in a try catch block but still I cannot catch the
exception. I don't want to throw the exception but to catch the exception
and handle it in my way.Kindly help me with this.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Endpoint-configuration-error-tp5728272.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Opposite of split

2013-02-27 Thread Claus Ibsen
On Wed, Feb 27, 2013 at 11:38 PM, Jean Francois LE BESCONT
 wrote:
> Hey all !
>
> I have read the document by I have not really understand which component
> should I use if I want to "unsplit" all message. I think that aggregate (
> and aggregate2 ) are their for that but I don't understand how to use it.
> The documentation says :
>
> "If you want to aggregate all messages into a single message, just use a
> constant expression."
>
> It is a little but obscur for me... what should I write instead of  :
>
> from("file://C:/Temp/camel/test/?noop=true") .split(body().tokenize("\n"))
> // [ BUSINESS TASKS] //  //
> .to("file://C:/Temp/camel/test?fileName=out.csv") // .end();
>
> Thanks for read this message even if you don't solve it :)
>
> JF

I suggest to study the EIPs
http://camel.apache.org/eip

There is the composed message processor EIP which looks a bit what you are doing
http://camel.apache.org/composed-message-processor.html

Notice that this eip can run in to modes (splitter + aggregator or in
splitter only mode).
The latter is often easier to use.

-- 
Claus Ibsen
-
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: camel content enricher Aggregtation Strategy example error?

2013-02-27 Thread Claus Ibsen
On Wed, Feb 27, 2013 at 11:07 PM, kingolego  wrote:
> The EIP Content Enricher page
>    has an example
> implementation of an AggregationStrategy for use with an enrich(er).
>
> I believe the example's use of resource.getOut() may be incorrect. In actual
> use, the enricher (resource) Exchange has been "pipelined" like any other
> exchange. In other words, you need to access resource.getIn() to access the
> enriching data.
>
> Perhaps there are route configurations where this would not be the case, but
> it would be better if the example addressed the more general case.
>
> If I'm missing something bigger, let me know.
>

Yes this is wrong. I have fixed the docs.


>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-content-enricher-Aggregtation-Strategy-example-error-tp5728254.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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: JPA Endpoint : Testing with Derby in-memory DB

2013-02-27 Thread Claus Ibsen
On Wed, Feb 27, 2013 at 10:55 PM, shyenuganti  wrote:
> Here is my sample route. It is working fine with camel:run. I am able to read
> from the DB.
>
>
> from("oracleJpa://com.model.EventQueue?consumeDelete=false&consumer.delay=25000")
> .id("OracleListener")
> .to("log:{body}")
> .to("mock:JPAMock");
>
> For testing the route, I have setup an inmemory Derby Database and am trying
> to assert on the mock.
>
> EventQueue event = new EventQueue();
> event.setEventLastChangeUser("yenuganti");
> event.setEventMessage("TestMessage");
>
> List expectedBodies = new ArrayList();
> expectedBodies.add(event);
>
> mock.setExpectedMessageCount(1);
> mock.expectedBodiesReceived(expectedBodies);
> mock.setResultWaitTime(15000);
> mock.assertIsSatisfied();
>
> It is failing on the assertion
>
> *java.lang.AssertionError: mock://JMSMock Received message count. Expected:
> <1> but was: <0>*
>
> There is one record in my derby DB. But why is my JPA endpoint not able to
> read it ?
>

I suggest to look at the camel-jpa unit test source code as we use
Derby for unit testing that component itself
https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/

You really should try harder to solve this yourselves before posting.
For example can you see any errors in the logs. Have you configured
the JPA correctly? And what do you see if you enable DEBUG/TRACE
logging etc?



> Please help.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/JPA-Endpoint-Testing-with-Derby-in-memory-DB-tp5728253.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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: Completion size question dynamic

2013-02-27 Thread Claus Ibsen
On Thu, Feb 28, 2013 at 5:06 AM, Gvvenkat  wrote:
> I am using splitter with aggregator for processing a large file. So it is
> hard for me to know no of splits the splitter produces feeding to the
> aggregator.  Since completion size one of key attribute for aggregator, how
> can I work around this issue.
>
> Please advise
>

See the splitter eip documentation
http://camel.apache.org/splitter

There is a table that lists the properties set on the exchange about
the current split index / size / completed etc


> Thanks in advance.
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Completion-size-question-dynamic-tp5728259.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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


Completion size question dynamic

2013-02-27 Thread Gvvenkat
I am using splitter with aggregator for processing a large file. So it is
hard for me to know no of splits the splitter produces feeding to the
aggregator.  Since completion size one of key attribute for aggregator, how
can I work around this issue. 

Please advise

Thanks in advance.   





--
View this message in context: 
http://camel.465427.n5.nabble.com/Completion-size-question-dynamic-tp5728259.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-blueprint-test issues

2013-02-27 Thread Ryan Moquin
I converted a test that was using the camel-test library to the
camel-test-blueprint library and it appears that the route runs at least
twice, but at the exact same time.  I'm not sure why each route is being
created more than once per test.  I do see at the beginning of the test it
print out that I't loading the bundle activator twice.  I also generated a
sample camel blueprint project from the maven archetype and it appears to
exhibit the same behavior.

I'using 2.11-SNAPSHOT btw.  I haven't seen anyone mention this nor did I
see anything in jira about it.  Has anyone noticed anything similar?
 I decided I'd have to try using karaf pax exam instead since I just can't
to figure out how to get the blueprint the testing working correctly.
 Hopefully someone has seen and gotten past that behavior.

Thanks for any suggestions or help!

Ryan


Re: cxf response

2013-02-27 Thread David Karlsen
For the jaxb stuff, see:
"Partial marshalling/unmarshalling" on http://camel.apache.org/jaxb.html

2013/2/27 Smith-John :
> I also tried it with generated JAXB classes from my wsdl/xsd and marshalling.
>
> But
> from("cxf:cxfEndpoint?wsdlURL&dataFormat=PAYLOAD").unmarshal(jaxb).process(myProcessor).to("bean:myBean").marshall(jaxb)
> doesn't work.
>
> myBean puts an Object of the generated jaxb classes into the body but I get
> unable to marshal type "example.ExampleResponse" as an element because it is
> missing an @XmlRootElement annotation.
>
> Some advice to fix this would be nice.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/cxf-response-tp5728106p5728236.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


camel content enricher Aggregtation Strategy example error?

2013-02-27 Thread kingolego
The EIP Content Enricher page
   has an example
implementation of an AggregationStrategy for use with an enrich(er).

I believe the example's use of resource.getOut() may be incorrect. In actual
use, the enricher (resource) Exchange has been "pipelined" like any other
exchange. In other words, you need to access resource.getIn() to access the
enriching data.

Perhaps there are route configurations where this would not be the case, but
it would be better if the example addressed the more general case.

If I'm missing something bigger, let me know.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-content-enricher-Aggregtation-Strategy-example-error-tp5728254.html
Sent from the Camel - Users mailing list archive at Nabble.com.


JPA Endpoint : Testing with Derby in-memory DB

2013-02-27 Thread shyenuganti
Here is my sample route. It is working fine with camel:run. I am able to read
from the DB. 


from("oracleJpa://com.model.EventQueue?consumeDelete=false&consumer.delay=25000")
.id("OracleListener")
.to("log:{body}")
.to("mock:JPAMock");

For testing the route, I have setup an inmemory Derby Database and am trying
to assert on the mock.

EventQueue event = new EventQueue();
event.setEventLastChangeUser("yenuganti");
event.setEventMessage("TestMessage");

List expectedBodies = new ArrayList();
expectedBodies.add(event);

mock.setExpectedMessageCount(1);
mock.expectedBodiesReceived(expectedBodies);
mock.setResultWaitTime(15000);
mock.assertIsSatisfied();

It is failing on the assertion 

*java.lang.AssertionError: mock://JMSMock Received message count. Expected:
<1> but was: <0>*

There is one record in my derby DB. But why is my JPA endpoint not able to
read it ?

Please help. 




--
View this message in context: 
http://camel.465427.n5.nabble.com/JPA-Endpoint-Testing-with-Derby-in-memory-DB-tp5728253.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help converting a Spring queue definition to a Camel endpoint

2013-02-27 Thread Mond Raymond
The program wants to access the queues via jndi - and this is how you get jetty 
to expose those features using jndi.

You don't have to use jndi of course, this was just as example for cases where 
that is desirable or needed.

Best regards

Ray

Sent from my iPad

On 27 Feb 2013, at 13:29, "nakshathri [via Camel]" 
 wrote:

> Hello Ray, Thanks for this. I think it will save lots of my time. But one 
> small information i need. Why do we need jetty configuration file? Can you 
> please explain. Regards, Manjunath 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://camel.465427.n5.nabble.com/how-to-configure-sending-to-MQseries-tp478478p5728222.html
> To unsubscribe from how to configure sending to MQseries, click here.
> NAML




--
View this message in context: 
http://camel.465427.n5.nabble.com/Re-Need-help-converting-a-Spring-queue-definition-to-a-Camel-endpoint-tp5728251.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Packaging camel project (under Karaf)

2013-02-27 Thread Achim Nierbeck
Hi,

you probably should try to build your own features file and use it in
conjunction with the maven-karaf-features plugin to
create your own pre-packaged Karaf distribution.
Unfortunately since our change to svn-pub-sub the documentation disappeared
I would have given you some
direct links to the online documentation :/
But if you search for "Custom distributions" in the available manual at
[1].
There is a sample on how to do this.

regards, Achim

[1] -
http://repo.maven.apache.org/maven2/org/apache/karaf/manual/2.3.0/manual-2.3.0.html




2013/2/27 Martin Stiborský 

> Hello guys,
> I'm wondering, how you are packaging yours Camel projects under Karaf?
> Sure, I found and used this:
> https://cwiki.apache.org/confluence/display/KARAF/6.2.+Custom+distributions
> Good thing, I'm able to create a tarball package.
> Actually, we need to package Apache Karaf, with all dependencies, like
> Camel, various libraries plus our own bundles with Camel routes, etc - and
> package it as a RPM package.
>
> The problem is mainly with our own code/artifacts. On various environment,
> there might be not a internet access at the moment, and for sure there will
> be no chance to download our artifacts from our Maven.
> So all of these have to prepackaged.
> I can use the tarball package created by Maven, following the howto
> mentioned above, extract the tarball, start Karaf in our environment, with
> access to Maven, let it download all things it needs (features.xml for our
> project), then stop it, package it again and make a RPM from that.
>
> But I don't like this manual part I have to do :( At least for our camel
> bundles I can just place them into "deploy/" directory, but what to do with
> all the libraries? There I'd like to rather utilize
> Karaf's org.apache.karaf.features.cfg and list there all features I need to
> install. For the libraries, I have them all specified in features.xml, so
> In Karaf I can just "features:install my-project-libs" and job is done.
>
> So, do you know some trick, how to automate it even better? How to
> eliminate the manual part with starting Carafe and repackaging to get it
> really ready?
>
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: st...@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi
>



-- 

Apache Karaf  Committer & PMC
OPS4J Pax Web  Committer &
Project Lead
OPS4J Pax for Vaadin 
Commiter & Project Lead
blog 


Re: Packaging camel project (under Karaf)

2013-02-27 Thread Henryk Konsek
Hi Martin,

> On various environment,
> there might be not a internet access at the moment, and for sure there will
> be no chance to download our artifacts from our Maven.
> So all of these have to prepackaged.

What about creating local Maven repository? You can tell Karaf to read
from any repo you want, not necessarily remote one. Maven Dependency
plugin and its go-offline mojo [1] could be very useful here.

Best regards.

[1] http://maven.apache.org/plugins/maven-dependency-plugin/go-offline-mojo.html

--
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: Is there batch functionality in Camel?

2013-02-27 Thread Henryk Konsek
Hi Ivan,

> I wonder if the Spring Batch Component (
> http://camel.apache.org/springbatch.html) is proper to use in this case?

You can use CamelItemReader to pass messages into Spring Batch.
However I would say that your case is too simple to use Spring Batch
for this purpose.

I would advise to use aggregator instead.

from("seda:queue").
  aggregate().groupExchanges().
  completionSize(1000).completionTimeout(1).
  to("seda:aggregatedResults");

Best regards.

--
Henryk Konsek
http://henryk-konsek.blogspot.com


Packaging camel project (under Karaf)

2013-02-27 Thread Martin Stiborský
Hello guys,
I'm wondering, how you are packaging yours Camel projects under Karaf?
Sure, I found and used this:
https://cwiki.apache.org/confluence/display/KARAF/6.2.+Custom+distributions
Good thing, I'm able to create a tarball package.
Actually, we need to package Apache Karaf, with all dependencies, like
Camel, various libraries plus our own bundles with Camel routes, etc - and
package it as a RPM package.

The problem is mainly with our own code/artifacts. On various environment,
there might be not a internet access at the moment, and for sure there will
be no chance to download our artifacts from our Maven.
So all of these have to prepackaged.
I can use the tarball package created by Maven, following the howto
mentioned above, extract the tarball, start Karaf in our environment, with
access to Maven, let it download all things it needs (features.xml for our
project), then stop it, package it again and make a RPM from that.

But I don't like this manual part I have to do :( At least for our camel
bundles I can just place them into "deploy/" directory, but what to do with
all the libraries? There I'd like to rather utilize
Karaf's org.apache.karaf.features.cfg and list there all features I need to
install. For the libraries, I have them all specified in features.xml, so
In Karaf I can just "features:install my-project-libs" and job is done.

So, do you know some trick, how to automate it even better? How to
eliminate the manual part with starting Carafe and repackaging to get it
really ready?


-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: st...@njs.netlab.cz
Twitter: http://www.twitter.com/stibi


Re: Is it possible to implement "Last value queue" using Camel?

2013-02-27 Thread Raul Kripalani
Hi Paul,

Last image caching for topics is part of the retroactive consumer
feature of AMQ. It allows for topic consumers to travel back to the
past without being durable subscribers.

I didn't mention it because, as far as I understood your use case, you
want the last message to be retained for each different value of a
particular property which acts like a bucket identifier. Correct? To
use the last image subscription recovery policy, you'd have to create
one topic per unique bucket ID, and your subscriber would have to
subscribe to all topics, which is a suboptimal solution in my opinion.
Performance would also be affected due to constant creation of topics
unless your buckets are finite.

Like someone mentioned, you could implement this as a broker plugin,
where you'd somehow keep track of the buckets and the
MessageReferences they contain, deleting old ones as newer messages
pop up. But I don't think it will be a simple plugin ;)

Maybe the AMQ user list could shed more light or instructions.

Regards,
Raúl.

On 26 Feb 2013, at 03:10, Paul Gale  wrote:

>> Your use case doesn't fit with the concept of messaging
>
> I don't see why as the concept of "last value" queues originates in
> queuing. In fact JBoss, HornetQ and Qpid all offer "last value queues".
> It's just that none of those products are an option for me.
>
> I've since found out that ActiveMQ does implement the moral equivalent of a
> "last value" queue, albeit as a topic. However, I don't yet know whether it
> is an  _exact_ equivalent. It would seem that it's more of a consumer
> subscription option than an aspect of the way the queue itself was
> constructed. Regardless, in ActiveMQ it's called "last image caching". It
> is implemented as part of the lastImageSubscriptionRecoveryPolicy as
> documented here:
> http://activemq.apache.org/subscription-recovery-policy.html.
>
> Also, delaying a message for delivery at some point in the future seems to
> me to be in the sweet spot of the Delayer EIP.  There's no place where it
> says that Delayer is only supposed to work with short delays. If I want to
> delay a message for days that should be just fine - that's why we have
> persistence. I realize that the Delayer does not support persistence so
> presumably everything is kept in memory making it failover intolerant. As
> you're a Camel committer do you know of any plans to make the Delayer EIP
> failover tolerant?
>
> This, I presume, is the same problem that plagues the Resequencer which, as
> far as I can tell, does not have a way to externalize it's temporal state
> either. Any news on when the Resequencer will have this feature added?
>
> Thanks,
> Paul
>
> On Mon, Feb 25, 2013 at 5:40 PM, Raul Kripalani  wrote:
>
>> You might be better off using Redis or another technology rather than
>> a message broker.
>> Your use case doesn't fit with the concept of messaging, lightweight
>> DB storage is better suited. While you can find ways to implement it
>> on AMQ, the solution will be suboptimal.
>> We offer a camel-redis component as of Camel 2.11. You can use it with
>> camel-jms to bridge JMS clients with Redis, if need be.
>>
>> Regards,
>> Raúl.
>> Apache Camel Committer
>>
>> On 25 Feb 2013, at 16:01, Paul Gale  wrote:
>>
>>> Hi,
>>>
>>> FYI: I am using ActiveMQ 5.8 with Camel 2.10.3.
>>>
>>> Is it possible to implement 'last value queue' type semantics using
>> Camel?
>>> As far as I know ActiveMQ does not natively support 'last value queues'
>>> therefore I am left trying to implement this via Camel.
>>>
>>> The particular scenario I am looking to implement is as follows: using
>>> Camel's Delayer EIP messages that match a certain criteria will be
>> delayed
>>> by 24 hours, say, before being delivered. If an update to a message
>> already
>>> held by the Delayer arrives it must over write the previously seen
>> version
>>> of the same message. For example, if ten updates to the same message
>> arrive
>>> during the delay period then only the tenth update is dispatched to the
>>> consumer.
>>>
>>> This is essentially the inverse of the IdempotentConsumer EIP which
>>> dispatches the first (as opposed to the last) version of a message an
>> then
>>> filters out subsequent duplicates.
>>>
>>> Thanks,
>>> Paul
>>


Problem polling UNIX FTP server

2013-02-27 Thread GarethHughes
Hi,

I'm new to Camel so I may have missed something obvious. 

I am using Camel 2.10.3, running on Windows 2003 server and Java 1.6.

 I am attempting to poll files from an FTP endpoint using the following URL:

ftp:egate@devweb/camel_hosts/REMHOST_A/out?password=*&binary=true&localWorkDirectory={{work_base_directory}}/REMHOST_A/receive&ftpClient.dataTimeout=3000&move=..//sent&stepwise=false

The FTP server is running on Solaris 10...
ftp> quote SYST
215 UNIX Type: L8 Version: SUNOS

However, Camel appears to think it is an Windows box as it is replacing UNIX
style file separators with Windows style separators

[vweb/camel_hosts/REMHOST_A/out] GenericFileOnCompletionWARN  Caused
by: [org.apache.camel.component.file.GenericFileOperationFailedException -
File operation failed: 550 \apps\seebeyond: No such file or directory.
 Cannot change directory to: \apps\seebeyond. Code: 550]
org.apache.camel.component.file.GenericFileOperationFailedException: File
operation failed: 550 \apps\seebeyond: No such file or directory.
 Cannot change directory to: \apps\seebeyond. Code: 550
at
org.apache.camel.component.file.remote.FtpOperations.doChangeDirectory(FtpOperations.java:702)[camel-ftp-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.remote.FtpOperations.changeCurrentDirectory(FtpOperations.java:658)[camel-ftp-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.remote.FtpOperations.buildDirectory(FtpOperations.java:284)[camel-ftp-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:100)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:199)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.UnitOfWorkProcessor.processSync(UnitOfWorkProcessor.java:139)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:115)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:336)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:94)[camel-ftp-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)[camel-core-2.10.3.jar:2.10.3]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source)[:1.6.0_26]
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown
Source)[:1.6.0_26]
at java.util.concurrent.FutureTask.runAndReset(Unknown 
Source)[:1.6.0_26]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)[:1.6.0_26]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)[:1.6

Re: Is there batch functionality in Camel?

2013-02-27 Thread Maruan Sahyoun
you could use the Aggregator for that http://camel.apache.org/aggregator2.html

Maruan Sahyoun

Am 27.02.2013 um 18:19 schrieb Ivan Vasilev :

> I wonder if the Spring Batch Component (
> http://camel.apache.org/springbatch.html) is proper to use in this case?
> 
> Ivan



Re: Is there anyway to configure the JPA component to get it's query (or query parameters) from an inbound message?

2013-02-27 Thread Chris Wolf
I figured out how to do it.  If anyone is interested, I can supply details.

On Wed, Feb 27, 2013 at 10:54 AM, Chris Wolf  wrote:
> I ask because I want the query to be parameterized by the results of
> up-stream component executions.
>
> Thanks,
>
>
> Chris


Is there batch functionality in Camel?

2013-02-27 Thread Ivan Vasilev
Hi All,

I wonder if I can set messages from/to some endpoint to be sent on batches.
I need this because the total time for sending messages one by one in some
cases is far bigger than packing say 1k messages and sending them at once.

For example if I have the following code:
from("file://inputdir/").convertBodyTo(String.class).to("jms:test.queue")

Is there way to set Camel to send newly created files in "inputdir" on
batches of 1k files, or on each 10 seconds, whatever first occurs.

Thanks,
Ivan


Is there anyway to configure the JPA component to get it's query (or query parameters) from an inbound message?

2013-02-27 Thread Chris Wolf
I ask because I want the query to be parameterized be the results of
up-stream component executions.

Thanks,


Chris


Re: cxf response

2013-02-27 Thread Smith-John
Thx Willem.

@Christian Mueller: No I have no problems to implement it. I just wanted to
know if I have to wrap the response into a xml document by myself or if
camel does this for me.



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


RE: Is it possible to implement "Last value queue" using Camel?

2013-02-27 Thread Zhemzhitsky Sergey
What about implementing LVQ activemq plugin?

http://activemq.apache.org/developing-plugins.html

Here are a bunch of examples:

http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/util/
http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/plugin/


Best Regards,
Sergey Zhemzhitsky
Phone. +7 495 2580500 ext. 1246


-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Tuesday, February 26, 2013 11:09 AM
To: users@camel.apache.org
Subject: Re: Is it possible to implement "Last value queue" using Camel?

On Tue, Feb 26, 2013 at 4:09 AM, Paul Gale  wrote:
>>Your use case doesn't fit with the concept of messaging
>
> I don't see why as the concept of "last value" queues originates in 
> queuing. In fact JBoss, HornetQ and Qpid all offer "last value queues".
> It's just that none of those products are an option for me.
>
> I've since found out that ActiveMQ does implement the moral equivalent 
> of a "last value" queue, albeit as a topic. However, I don't yet know 
> whether it is an  _exact_ equivalent. It would seem that it's more of 
> a consumer subscription option than an aspect of the way the queue 
> itself was constructed. Regardless, in ActiveMQ it's called "last 
> image caching". It is implemented as part of the 
> lastImageSubscriptionRecoveryPolicy as documented here:
> http://activemq.apache.org/subscription-recovery-policy.html.
>
> Also, delaying a message for delivery at some point in the future 
> seems to me to be in the sweet spot of the Delayer EIP.  There's no 
> place where it says that Delayer is only supposed to work with short 
> delays. If I want to delay a message for days that should be just fine 
> - that's why we have persistence. I realize that the Delayer does not 
> support persistence so presumably everything is kept in memory making 
> it failover intolerant. As you're a Camel committer do you know of any 
> plans to make the Delayer EIP failover tolerant?
>
> This, I presume, is the same problem that plagues the Resequencer 
> which, as far as I can tell, does not have a way to externalize it's 
> temporal state either. Any news on when the Resequencer will have this 
> feature added?
>

ActiveMQ supports sending messages with a delayed timestamp / cron expression 
etc.
http://activemq.apache.org/delay-and-schedule-message-delivery.html

You can use that to schedule and delay a message for 24 hours. Then the message 
is persisted and forwarded.
The Camel delayer is in-memory only and NOT a good idea for long delays.

And ActiveMQ supports virtual topics
http://activemq.apache.org/virtual-destinations.html

Not sure if they would support the last image policy. But for this kind of 
question I suggest to ask on the ActiveMQ @user list.

> Thanks,
> Paul
>
> On Mon, Feb 25, 2013 at 5:40 PM, Raul Kripalani  wrote:
>
>> You might be better off using Redis or another technology rather than 
>> a message broker.
>> Your use case doesn't fit with the concept of messaging, lightweight 
>> DB storage is better suited. While you can find ways to implement it 
>> on AMQ, the solution will be suboptimal.
>> We offer a camel-redis component as of Camel 2.11. You can use it 
>> with camel-jms to bridge JMS clients with Redis, if need be.
>>
>> Regards,
>> Raúl.
>> Apache Camel Committer
>>
>> On 25 Feb 2013, at 16:01, Paul Gale  wrote:
>>
>> > Hi,
>> >
>> > FYI: I am using ActiveMQ 5.8 with Camel 2.10.3.
>> >
>> > Is it possible to implement 'last value queue' type semantics using
>> Camel?
>> > As far as I know ActiveMQ does not natively support 'last value queues'
>> > therefore I am left trying to implement this via Camel.
>> >
>> > The particular scenario I am looking to implement is as follows: 
>> > using Camel's Delayer EIP messages that match a certain criteria 
>> > will be
>> delayed
>> > by 24 hours, say, before being delivered. If an update to a message
>> already
>> > held by the Delayer arrives it must over write the previously seen
>> version
>> > of the same message. For example, if ten updates to the same 
>> > message
>> arrive
>> > during the delay period then only the tenth update is dispatched to 
>> > the consumer.
>> >
>> > This is essentially the inverse of the IdempotentConsumer EIP which 
>> > dispatches the first (as opposed to the last) version of a message 
>> > an
>> then
>> > filters out subsequent duplicates.
>> >
>> > Thanks,
>> > Paul
>>



--
Claus Ibsen
-
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

___
CONFIDENTIALITY NOTICE: This email and any files attached to it may be 
confidential. If you are not the intended recipient you are notified that 
using, copying, distributing or taking any action in reliance on the 

Re: Invoking a static bean method in my camel xml

2013-02-27 Thread David Karlsen
Yes, it's not very well documented.
Here is an example:

in the middle of a route I do:



which will replace the body after the step in the route with the
substring 150 chars into the incoming payload.

2013/2/27 bikehead :
> Is it possible to invoke a static method to a class within my camel.xml
> configuration?
>
> For example I'd like to do something like:
> 
>
> Googleing shows an example of java route builder doing the equivilant of:
> .bean(org.apache.log4j.MDC.class, "put('dpservices.storyKey',
> ${body.urlKey})"
>
> when buiding the route, but I can't find any discussion of doing it in an
> xml file
>
>
> -Brian
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Invoking-a-static-bean-method-in-my-camel-xml-tp5728228.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


Re: camel processor in InOut to send 2 replies

2013-02-27 Thread Marco Crivellaro
Hi Hadrian,
thanks for your reply. Sorry if I've been unclear.
The messages I am publishing to the In queue have JMSReplyTo header set.


 As you suggested I've used the reply to header to send an additional
message using a bespoke producer in the process method of the Processor:


javax.jms.Destination replyTo =
exchange.getIn().getHeader("JMSReplyTo", javax.jms.Destination.class);
JmsEndpoint replyEndpoint = new JmsEndpoint();
replyEndpoint.setDestination(replyTo);  
DefaultProducerTemplate producer = (DefaultProducerTemplate)
exchange.getContext().createProducerTemplate(); 
producer.sendBodyAndHeaders(replyEndpoint.getEndpointUri().toString(),
"TEST", exchange.getOut().getHeaders());



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-processor-in-InOut-to-send-2-replies-tp5728189p5728230.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Invoking a static bean method in my camel xml

2013-02-27 Thread bikehead
Is it possible to invoke a static method to a class within my camel.xml
configuration?

For example I'd like to do something like:


Googleing shows an example of java route builder doing the equivilant of:
.bean(org.apache.log4j.MDC.class, "put('dpservices.storyKey',
${body.urlKey})"

when buiding the route, but I can't find any discussion of doing it in an
xml file


-Brian




--
View this message in context: 
http://camel.465427.n5.nabble.com/Invoking-a-static-bean-method-in-my-camel-xml-tp5728228.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Spring-ws producer endpointMapping

2013-02-27 Thread Claus Ibsen
On Wed, Feb 27, 2013 at 1:42 PM, anaCortes  wrote:
> any idea about how to add an endpointMapping to a spring-ws producer? ;)
>

I suggest to check the source code and see what is possible. Maybe its
doable, or an improvement is needed in the component to support what
you want.


>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Spring-ws-producer-endpointMapping-tp5728172p5728223.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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: Split an empty list

2013-02-27 Thread developpef
Just a proposal : it might be great to write in the documentation a post
about how to manage the ".end()" instruction : what components need it? how
two not "cross" them and avoid confusions?

Like in :

.loop(3)
.to(...)
.split(...)
.end()  --> what END is it?



-
http://developpef.blogspot.com
--
View this message in context: 
http://camel.465427.n5.nabble.com/Split-an-empty-list-tp5728214p5728226.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Split an empty list

2013-02-27 Thread developpef
OK, after a test, you're right, it is now working as expected.

Thanks for pointing me this tip!



-
http://developpef.blogspot.com
--
View this message in context: 
http://camel.465427.n5.nabble.com/Split-an-empty-list-tp5728214p5728225.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Split an empty list

2013-02-27 Thread Claus Ibsen
Hi

Yes its this eip
http://camel.apache.org/composed-message-processor.html

The Camel splitter has a built-in aggregation stragegy which is much
easier to use than split + aggregate.
See the example on the page above, about using ONLY splitter.


On Wed, Feb 27, 2013 at 1:28 PM, developpef  wrote:
> Well, after my SPLIT I use an aggregation Strategy with completionPredicate
> to Exchange.SPLIT_COMPLETE.
>
> So if I understand, I would rather write :
>
> .split(body(), myAggregationStrategy)
> (... split operations ...)
> .end()
>
> rather than :
>
> .split(body())
> (... split operations ...)
> .aggregate(...)
> .completionPredicate(header(Exchange.SPLIT_COMPLETE).isEqualTo(Boolean.TRUE))
>
> Am I right? And in the first case, will my aggregation strategy complete on
> Exchange.SPLIT_COMPLETE as well?
>
>
>
> -
> http://developpef.blogspot.com
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Split-an-empty-list-tp5728214p5728221.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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: Spring-ws producer endpointMapping

2013-02-27 Thread anaCortes
any idea about how to add an endpointMapping to a spring-ws producer? ;)



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-ws-producer-endpointMapping-tp5728172p5728223.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Split an empty list

2013-02-27 Thread developpef
Well, after my SPLIT I use an aggregation Strategy with completionPredicate
to Exchange.SPLIT_COMPLETE.

So if I understand, I would rather write :

.split(body(), myAggregationStrategy)
(... split operations ...)
.end()

rather than :

.split(body())
(... split operations ...)
.aggregate(...)
.completionPredicate(header(Exchange.SPLIT_COMPLETE).isEqualTo(Boolean.TRUE))

Am I right? And in the first case, will my aggregation strategy complete on
Exchange.SPLIT_COMPLETE as well?



-
http://developpef.blogspot.com
--
View this message in context: 
http://camel.465427.n5.nabble.com/Split-an-empty-list-tp5728214p5728221.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Quartz component support for storing schedule in database rather than in-memory

2013-02-27 Thread Claus Ibsen
On Wed, Feb 27, 2013 at 12:43 PM, gilboy  wrote:
> Hi
>
> I just wanted to confirm that the quartz component does not support storing
> the schedule in the database rather than in-memory
>

What do you mean? Can you be more specific what you mean by storing "schedule"

You can configure the quartz component to use a database or whatever
store quartz supports. eg such as in the quartz.properties file.



> Thanks
> Joe
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Quartz-component-support-for-storing-schedule-in-database-rather-than-in-memory-tp5728215.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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: Split an empty list

2013-02-27 Thread Claus Ibsen
On Wed, Feb 27, 2013 at 11:46 AM, developpef  wrote:
> Hello,
>
> Here is what happens :
>
> My route is :
>
> from("direct:inside")
> .log(LoggingLevel.INFO, " start")
> .beanRef(MY_SERVICE, "retrieveDataList")
> .log(LoggingLevel.INFO, " before split ${body}")
> .split(body())
> .log(LoggingLevel.INFO, " after split ${body}")
>
> And my logs :
>
> |2013-02-27 11:30:58|INFO|route3| start|
> |2013-02-27 11:30:58|INFO|route3| before split []|
>
> That's all! When my bean retrieves an empty list, the SPLIT shortcuts my
> whole route and nothing is done after on it... With a not empty list, it
> works fine.
>
> I'm using Camel 2.10.2
>
> Did I miss something?
>

No the splitter only outputs messages if there is data to split. And
if you have an empty list / null body etc. then nothing is output from
the splitter.

If you want to do stuff AFTER the splitter is fully done, then close
the block with end(), eg

form
   to
   split body
 to inside splitter
   end()
   to outside splitter



> Thanks
>
>
>
> -
> http://developpef.blogspot.com
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Split-an-empty-list-tp5728214.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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: camel-quickfix RequestReplyExample java.io.IOException

2013-02-27 Thread stevebate

On Feb 27, 2013, at 3:12 AM, "Babak Vahdat [via Camel]" 
 wrote:

> Hi Steve 
> 
> Thanks for looking into this. Unfortunately the provided patch causes 
> regressions by some pre-existing tests of this component. I've provided the 
> details of this into the ticket itself, so let's continue the conversation 
> inside JIRA itself to avoid making noise here @ the user forum. 

Sorry. I should have run the unit tests before submitting the patch. I've 
submitted an updated patch with changes to the unit test mock setup for the new 
Exchange copy behavior and the sessionID reversal in the MessagePredicate. I 
agree we can continue any patch-related discussion using Jira. However, the 
following discussion might be of general interest.

> And regarding your surprise maybe the following thread could be helpful for a 
> better understanding: 
> 
> http://camel.465427.n5.nabble.com/About-what-to-do-with-the-Response-retrieved-through-a-Producer-when-the-Exchange-is-NOT-out-capable-td5713946.html
> 
> In general if the MEP is InOnly and a service invocation (through a Camel 
> Producer) returns a reply, then a good practice is to set the reply as the 
> body of the IN message. This would make the next processor in chain to make 
> use of this IN object as it say here: 

This is confusing to me because the Exchange is now InOut, not InOnly. I did 
some experimentation and found that this route,

  
from("quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:MARKET->TRADER&exchangePattern=InOut")

.filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.ORDER_STATUS_REQUEST))
.bean(new MarketOrderStatusService())
.bean(new QuickfixjMessageJsonPrinter());

required the Exchange copy for the InOut MEP because the inbound message is 
overwritten by subsequent processors. However, 
the following route does not require the copy (the QuickfixjMessageJsonPrinter 
bean has been removed).

  
from("quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:MARKET->TRADER&exchangePattern=InOut")

.filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.ORDER_STATUS_REQUEST))
.bean(new MarketOrderStatusService());

Does this mean that the QuickfixjConsumer is sometimes required to copy the 
inbound Exchange (InOut MEP) and sometimes not,
depending on the route components that follow it? If so, the safe behavior is 
to always copy the Exchange, but it seems that it should
logically not need to do that for an InOut MEP.

> if there is no out message then the in message is used instead
> http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
> 





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quickfix-RequestReplyExample-java-io-IOException-tp5723769p5728217.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Split an empty list

2013-02-27 Thread developpef
Hello,

Here is what happens :

My route is :

from("direct:inside")
.log(LoggingLevel.INFO, " start")
.beanRef(MY_SERVICE, "retrieveDataList")
.log(LoggingLevel.INFO, " before split ${body}")
.split(body())
.log(LoggingLevel.INFO, " after split ${body}")

And my logs :

|2013-02-27 11:30:58|INFO|route3| start|
|2013-02-27 11:30:58|INFO|route3| before split []|

That's all! When my bean retrieves an empty list, the SPLIT shortcuts my
whole route and nothing is done after on it... With a not empty list, it
works fine.

I'm using Camel 2.10.2

Did I miss something?

Thanks



-
http://developpef.blogspot.com
--
View this message in context: 
http://camel.465427.n5.nabble.com/Split-an-empty-list-tp5728214.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-quickfix RequestReplyExample java.io.IOException

2013-02-27 Thread Christian Müller
Thanks Steve! Very appreciated!

Best,
Christian

Sent from a mobile device
Am 26.02.2013 17:39 schrieb "stevebate" :

>
> On Feb 25, 2013, at 2:21 PM, Babak Vahdat [via Camel] <
> ml-node+s465427n5728116...@n5.nabble.com> wrote:
> > As I did *not* backport the fix for CAMEL-5861 to this branch (because
> it was/is not a supported version anymore). However the example works
> properly on the 2.10.x branch as well as trunk with the proper JSON outputs
> for both the request (OrderStatusRequest) as well as the reply
> (ExecutionReport). But as because the QuickfixjConsumer doesn't honor the
> MEP (apparently it used to honor this at the time you donated it) there is
> currently no way to provide the ExecutionReport JSON output as the HTTP
> reply itself. Please take a look at the log output I've added to the
> example (the first comment of the ticket):
> >
> > https://issues.apache.org/jira/browse/CAMEL-5880
> >
> > As you see *although* we ask for the exchangePattern=InOut option
> through the URI the logged message shows an effective InOnly MEP!
>
> Hello Babak,
>
> I've found several issues with the example. I have a patch that fixes the
> InOnly MEP issue. I also found an issue with the MessagePredicate. It was
> reversing the FIX Session ID so the MessageCorrelator wasn't working
> correctly. I was surprised to see that when the component processes an
> exchange (QuickfixjConsumer.onExchange), Camel overwrites the inbound
> message in the exchange with the result of the service invocation. I copied
> the inbound exchange and restored the "In" before sending the service
> response. Finally, I reverted the modification to the message correlation
> so that the ExecutionReport is used instead of the OrderStatusRequest
> (2.10.x branch).
>
> The IOException was being raised because the ExecutionReport result was
> never correlated to the OrderStatusRequest. This was because of the InOut
> MEP issue and the problem with the MessagePredicate that is used for the
> correlation. The HTTP request didn't have a result to return so that caused
> the 500 server error after the message correlation timed out.
>
> With my patch, the example appears to fully work. I'll attach it to the
> Jira issue for your review.
>
> > Please be aware that I've got no expertise about the QuickFixJ framework
> or the FIX protocol itself and the fixes I've provided here are based on a
> best effort basis to make things work again (no HTTP 500 anymore). But
> having you as the founder of QuickFixJ and the Guru here in this thread
> makes me really happy! So please take a look at the stuff here to see if we
> could do even better.
>
> I have very little experience with Camel, so hopefully we can help each
> other on this task.
>
> > Last but not least that would be just awesome if we could make a proper
> Camel example module out of these classes which are currently under the
> path src/test/java of the camel-quickfix module itself, that's to make them
> like the other examples we have:
>
> I agree, but I'm not sure if I'll have time to make this change. We'll see.
>
> Steve
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-quickfix-RequestReplyExample-java-io-IOException-tp5723769p5728201.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Problem with donefilename on sftp.

2013-02-27 Thread seazor
Hi all,
i have a problem when writing donefilename on sftp. (Camel version 2.10.3)

I tried some possibilities in my route :
1) 
.to("sftp://camel@port-jogu?password=xxx&fileName=test.csv&doneFileName=test.done";)
All two files are written, but not in the place i wanted.

2) 
.to("sftp://camel@port-jogu/folder?password=xxx&fileName=test.csv&doneFileName=test.done";)
The results are :
folder/test.csv (file OK)
folder/folder (sub-folder empty : not OK)
and this stack trace :
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: 01234567890
01234567820
]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1287)
at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:618)
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:454)
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:450)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:126)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:131)
at
be.smals.dp.routes.lb.AskTutorWSRouteTest.testSend(AskTutorWSRouteTest.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
at
org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runTestMethod(UnitilsJUnit4TestClassRunner.java:174)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
at
org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runBeforesThenTestThenAfters(UnitilsJUnit4TestClassRunner.java:156)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
at
org.unitils.UnitilsJUnit4TestClassRunner.invokeTestMethod(UnitilsJUnit4TestClassRunner.java:95)
at
be.smals.stve.unitilsmodules.runner.StveJunit4TestClassRunner.invokeTestMethod(StveJunit4TestClassRunner.java:94)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at
org.unitils.UnitilsJUnit4TestClassRunner.access$000(UnitilsJUnit4TestClassRunner.java:44)
at
org.unitils.UnitilsJUnit4TestClassRunner$1.run(UnitilsJUnit4TestClassRunner.java:62)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at 
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at
org.unitils.UnitilsJUnit4TestClassRunner.run(UnitilsJUnit4TestClassRunner.java:68)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
change directory to: folder
at
org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:434)
at
org.apache.camel.component.file.remote.SftpOperations.changeCurrentDirectory(SftpOperations.java:422)
at
org.apache.camel.component.file.remote.SftpOperations.storeFile(SftpOperations.java:661)
at
org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:249)
at
org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:192)
at
org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:49)
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
at 
org.a

Re: A little problem with annotation @CsvRecord

2013-02-27 Thread jeff
Thanks @Ib it works in a better clean way with your method !




2013/2/26 lb [via Camel] 

> You may use the following syntax: .unmarshall().bindy(BindyType.Csv,Your
> Class.class)
>
> Bear in mind that the current implementation does scan the package of the
> viventi class thus you should not have any other bindy-annotated class in
> the same root package.
>
>
> On Monday, February 25, 2013, jeff wrote:
>
> > Thanks  @Claus for the help, but it don't works too...
> >
> > I have found a solution which consist to retrieve the bean from the
> context
> > from the routebuilder :
> >
> > spring bean xml :
> >  class="com.myapp...package.CSVLineFormatAED">
> >
> >
> > @CsvRecord(separator = ";" , crlf = "UNIX")
> > public class CSVLineFormatAED extends BindyCsvDataFormat {
> > public CSVLineFormatAED() {
> > super("com.myapppackage");
> > }
> > }
> >
> > public class BindyRoute extends RouteBuilder {
> >
> > @Override
> > public void configure() throws Exception {
> >
> > // Context Camel
> > SpringCamelContext camelCtx = (SpringCamelContext)
> > getContext();
> >
> > // Context Spring
> > ApplicationContext springCtx =
> > camelCtx.getApplicationContext();
> >
> > BindyCsvDataFormat camelDataFormatAED =
> > (BindyCsvDataFormat) springCtx
> > .getBean("cSVLineFormatAED");
> >
> > from("file:C:/input/test.csv")
> > .split(body().tokenize("\n"))
> > .unmarshal(camelDataFormatAED)
> > .to("mock:test").end();
> > ...
> > }
> >
> > Hope it will be helpfull for other developper !
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/A-little-problem-with-annotation-CsvRecord-tp5728109p5728119.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/A-little-problem-with-annotation-CsvRecord-tp5728109p5728196.html
>  To unsubscribe from A little problem with annotation @CsvRecord, click
> here
> .
> NAML
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/A-little-problem-with-annotation-CsvRecord-tp5728109p5728205.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-quickfix RequestReplyExample java.io.IOException

2013-02-27 Thread Babak Vahdat
Hi Steve

Thanks for looking into this. Unfortunately the provided patch causes
regressions by some pre-existing tests of this component. I've provided the
details of this into the ticket itself, so let's continue the conversation
inside JIRA itself to avoid making noise here @ the user forum.

And regarding your surprise maybe the following thread could be helpful for
a better understanding:

http://camel.465427.n5.nabble.com/About-what-to-do-with-the-Response-retrieved-through-a-Producer-when-the-Exchange-is-NOT-out-capable-td5713946.html

In general if the MEP is InOnly and a service invocation (through a Camel
Producer) returns a reply, then a good practice is to set the reply as the
body of the IN message. This would make the next processor in chain to make
use of this IN object as it say here:


> if there is no out message then the in message is used instead 

http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html

Babak


stevebate wrote
> On Feb 25, 2013, at 2:21 PM, Babak Vahdat [via Camel] <

> ml-node+s465427n5728116h57@.nabble

> > wrote:
>> As I did *not* backport the fix for CAMEL-5861 to this branch (because it
>> was/is not a supported version anymore). However the example works
>> properly on the 2.10.x branch as well as trunk with the proper JSON
>> outputs for both the request (OrderStatusRequest) as well as the reply
>> (ExecutionReport). But as because the QuickfixjConsumer doesn't honor the
>> MEP (apparently it used to honor this at the time you donated it) there
>> is currently no way to provide the ExecutionReport JSON output as the
>> HTTP reply itself. Please take a look at the log output I've added to the
>> example (the first comment of the ticket): 
>> 
>> https://issues.apache.org/jira/browse/CAMEL-5880
>> 
>> As you see *although* we ask for the exchangePattern=InOut option through
>> the URI the logged message shows an effective InOnly MEP! 
> 
> Hello Babak,
> 
> I've found several issues with the example. I have a patch that fixes the
> InOnly MEP issue. I also found an issue with the MessagePredicate. It was
> reversing the FIX Session ID so the MessageCorrelator wasn't working
> correctly. I was surprised to see that when the component processes an
> exchange (QuickfixjConsumer.onExchange), Camel overwrites the inbound
> message in the exchange with the result of the service invocation. I
> copied the inbound exchange and restored the "In" before sending the
> service response. Finally, I reverted the modification to the message
> correlation so that the ExecutionReport is used instead of the
> OrderStatusRequest (2.10.x branch). 
> 
> The IOException was being raised because the ExecutionReport result was
> never correlated to the OrderStatusRequest. This was because of the InOut
> MEP issue and the problem with the MessagePredicate that is used for the
> correlation. The HTTP request didn't have a result to return so that
> caused the 500 server error after the message correlation timed out.
> 
> With my patch, the example appears to fully work. I'll attach it to the
> Jira issue for your review.
> 
>> Please be aware that I've got no expertise about the QuickFixJ framework
>> or the FIX protocol itself and the fixes I've provided here are based on
>> a best effort basis to make things work again (no HTTP 500 anymore). But
>> having you as the founder of QuickFixJ and the Guru here in this thread
>> makes me really happy! So please take a look at the stuff here to see if
>> we could do even better. 
> 
> I have very little experience with Camel, so hopefully we can help each
> other on this task.
> 
>> Last but not least that would be just awesome if we could make a proper
>> Camel example module out of these classes which are currently under the
>> path src/test/java of the camel-quickfix module itself, that's to make
>> them like the other examples we have: 
> 
> I agree, but I'm not sure if I'll have time to make this change. We'll
> see.
> 
> Steve





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quickfix-RequestReplyExample-java-io-IOException-tp5723769p5728204.html
Sent from the Camel - Users mailing list archive at Nabble.com.