Debug exec of python script

2016-12-28 Thread jgewehr
I'm trying to figure out why my exec of a python script is failing.  My route
looks like this:

from.("sftp")
.to("file...")
.to("exec:test.py")
.to("log:foo?showAll");

So I'm transferring a file from an SFTP server to the local filesystem, and
then I want to run a python script on it.  The file transfer is working
fine.  However, my python script is returning an error.  When I look in the
log I see CamelExecStderr=java.io.ByteArrayInputStream@5944a314.  According
to the Exec component page here http://camel.apache.org/exec.html:  

ExecBinding.EXEC_STDERR java.io.InputStream The value of this header points
to the standard error stream (stderr) of the executable.

I just want to print the actual string value of stderr, not
java.io.ByteArrayInputStream@5944a314.  I feel like this should be easy and
I'm missing something.  How do I print the value of the headers on the Exec
component page, for example ExecBinding.EXEC_STDERR or
ExecBinding.EXEC_EXIT_VALUE?

Help?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Debug-exec-of-python-script-tp5791982.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Debug exec of python script

2016-12-28 Thread jgewehr
I thought I had tried that but I must have gotten the syntax wrong.

Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Debug-exec-of-python-script-tp5791982p5791984.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Synchronizing SFTP and ActiveMQ

2017-05-11 Thread jgewehr
I'm not sure if I'm thinking about this problem correctly so please provide
any feedback you think is appropriate.  Also, I hope I'm not asking a
duplicate question but I've looked around quite a bit and haven't exactly
found anything that addresses this situation.

I'm using camel 2.17.

I'm planning to have 2 routes: an ActiveMQ route and an SFTP route.  I have
a python script that
1) generates a file that needs to be SFTP'd to a server if needed
(sometimes there is no file), and then 
2) generates a json that is fed into the ActiveMQ route.  The process
that parses the json on the other end will do something with the SFTP
payload, if it exists.

The routes I'm thinking of implementing will look something like this:
SFTP route:
from("file:sftp_out_dir")
.to("sftp://ip:port etc");

ActiveMQ route:
from("file:amq_out_dir")
.to"activemq:queue:myqueue)

The problem that I see is that there is a potential race condition here,
where the AMQ message arrives before the SFTP transfer is completed and the
process that parses the JSON on the other end then errors because the file
that it is expecting is not there.  How can I prevent this race condition? 
The python script that is generating these files doesn't know anything about
camel, it is just generating files and dropping them into directories on the
file system.  So far this integration of python and camel has worked really
well for us because each operation was serial, but now we're trying to
simultaneously send a file on one route and a control message on another
route.

One solution that makes sense to me but I think isn't supported by camel
would be something like a nested route like this:

from(file:amq_out_dir)
.from(file:sftp_out_dir)
.to(sftp)
.to(activemq)

So even though that's not actually a thing you can do with Camel, that is
the behavior I want, i.e. drop the json file into the amq_out_dir, transfer
the file over SFTP if it exists, wait for the SFTP transfer to complete,
then deliver the AMQ message.  Am I thinking about this problem in the wrong
way?  What is the best way to solve this problem with Camel?

Thanks in advance for any advice.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Synchronizing-SFTP-and-ActiveMQ-tp5799345.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Synchronizing SFTP and ActiveMQ

2017-05-12 Thread jgewehr
Thanks but I don't think this is what I'm looking for. Anyone have any other
ideas?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Synchronizing-SFTP-and-ActiveMQ-tp5799345p5799394.html
Sent from the Camel - Users mailing list archive at Nabble.com.