You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by neilac333 <ne...@soteradefense.com> on 2012/12/12 07:06:51 UTC

Python Script Producing a File

I would like to trigger a Python script that generates a file as output. I
would then like this file to be processed along the rest of the route.

I have been unable to find documentation on how to create a Python script
endpoint at the beginning of the route and then the file endpoint waiting
for the script result. I have the rest of the route working as desired.

Any help with this is appreciated.

Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Python Script Producing a File

Posted by neilac333 <ne...@soteradefense.com>.
I will look at the exec command, but frankly I would prefer to use the native
Python (and any other scripting language for that matter) support rather
than exec. Still it is nice to know that is an option.

Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933p5723958.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Python Script Producing a File

Posted by Claus Ibsen <cl...@gmail.com>.
And there is a camel-exec to execute a command, for example to call
the phyton script.
http://camel.apache.org/exec

On Wed, Dec 12, 2012 at 8:18 AM, Willem jiang <wi...@gmail.com> wrote:
> Hi,
>
> You can use camel-timer or camel-direct endpoint to trigger the script.
> I just want ask what your plan to start the route which will call the script?
>
>
> --
> 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, December 12, 2012 at 2:06 PM, neilac333 wrote:
>
>> I would like to trigger a Python script that generates a file as output. I
>> would then like this file to be processed along the rest of the route.
>>
>> I have been unable to find documentation on how to create a Python script
>> endpoint at the beginning of the route and then the file endpoint waiting
>> for the script result. I have the rest of the route working as desired.
>>
>> Any help with this is appreciated.
>>
>> Thanks.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933.html
>> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
>
>
>



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

Re: Python Script Producing a File

Posted by neilac333 <ne...@soteradefense.com>.
Actually, I think that the current version of Camel requires something like
this:

<to uri="language:python:classpath:file.py" />

But your explanation was very helpful to getting me on the right path.

Thanks.





--
View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933p5724055.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Python Script Producing a File

Posted by Willem jiang <wi...@gmail.com>.
You can leverage camel-jetty or camel-servlet to receive the request, and then route the message to the script endpoint like this.
<from uri="jetty://localhost:8080/myservice"/>
<to uri="script:xxx"/>
…


--  
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, December 12, 2012 at 11:39 PM, neilac333 wrote:

> To answer your question, the trigger will be a web request to a certain URL.
> The web endpoint will receive the request and then fire off the Python
> script. The script could then either return a string for the directory name
> where the output file has been generated or the full path of the file
> itself. This should then serve as the message body for the next endpoint to
> do stuff with the file.  
>  
> Given this, how would the Spring DSL configuration look?
>  
> Thanks.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933p5723957.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Python Script Producing a File

Posted by neilac333 <ne...@soteradefense.com>.
To answer your question, the trigger will be a web request to a certain URL.
The web endpoint will receive the request and then fire off the Python
script. The script could then either return a string for the directory name
where the output file has been generated or the full path of the file
itself. This should then serve as the message body for the next endpoint to
do stuff with the file. 

Given this, how would the Spring DSL configuration look?

Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933p5723957.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Python Script Producing a File

Posted by Willem jiang <wi...@gmail.com>.
Hi,  

You can use camel-timer or camel-direct endpoint to trigger the script.  
I just want ask what your plan to start the route which will call the script?


--  
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, December 12, 2012 at 2:06 PM, neilac333 wrote:

> I would like to trigger a Python script that generates a file as output. I
> would then like this file to be processed along the rest of the route.
>  
> I have been unable to find documentation on how to create a Python script
> endpoint at the beginning of the route and then the file endpoint waiting
> for the script result. I have the rest of the route working as desired.
>  
> Any help with this is appreciated.
>  
> Thanks.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Python-Script-Producing-a-File-tp5723933.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).