You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by wagner <wa...@gmail.com> on 2012/08/10 07:08:34 UTC

how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Hi

How to install servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Best Regards



--
View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Yeah, you definitely should first consider to use camel component but not JBI component if you start a new project.

Freeman
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-11, at 下午12:53, wagner wrote:

> 
> thanks Freeman,
> 
> Testing the result by command "features:list | grep exec", a discovered
> camel-exec. 
> Allthough the success of servicemix-exec feature installation, I realized
> that camel-exec is more productive to me. 
> 
> What a great software is servicemix and its features!!!
> 
> Best regards 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714134.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Thanks for sharing your solution.

Freeman
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-27, at 上午3:45, wagner wrote:

> for future reference e for someone who interest in this same subject (run
> shell scripts) with rest request:
> 
> I am describe below what are working great for me now. It is a more simple
> aprouch, but I am afraid I lost the batch feature because described by
> Jean's post.
> 
> Although Its works, in the near future I will came back here to implement
> the batch feature again and a more dinamically pattern as I am growing in
> the learning camel.
> 
> I want to register my gratitude for the help and for the patience I found in
> this this forum!
> 
> 
> 
> package br.edu.fzlbpms.template.camel.batch.impl;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
> import javax.ws.rs.Produces;
> 
> @Path("/")
> public class ControllerService {
> 
>  @GET
>  @Path("/start/{command}")
>  @Produces("text/plain")
>  public String startRoute(@PathParam("command") String command) throws
> Exception {
> 	  return null;
>  }
> }
> 
> 
> <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="rsServer" address="http://localhost:9090/batch"
> 	
> serviceClass="br.edu.fzlbpms.template.camel.batch.impl.ControllerService"/>
> 
> 
>  <camelContext xmlns="http://camel.apache.org/schema/spring">
> 
>    <route id="control">
>        <from uri="cxfrs:bean:rsServer"/>
> 
>        <when>
>            <simple>${body} == 'fzl_fuseide'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_fuseide.sh"/>
>        </when>
>        <when>
>            <simple>${body} == 'fzl_open_gi'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_gi.sh"/>
>        </when>
>        <when>
>            <simple>${body} == 'fzl_eclipse_juno'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_eclipse_juno.sh"/>
>        </when>
>        <when>
>            <simple>${body} == 'fzl_open_birt_modeler'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_birt_modeler.sh"/>
>        </when>        
>        <when>
>            <simple>${body} == 'fzl_open_pror'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_pror.sh"/>
>        </when>                
>        <when>
>            <simple>${body} == 'fzl_start_apacheds_studio'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_start_apacheds_studio.sh"/>
>        </when>
>        <when>
>            <simple>${body} == 'fzl_jmeter'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_jmeter.sh"/>
>        </when>
>        <when>
>            <simple>${body} == 'fzl_open_soapui'</simple>
>            <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_soapui.sh"/>
>        </when>
>        						                               
>    </route>
> 
>  </camelContext>
> 
> </beans>
> 
> 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714250.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by wagner <wa...@gmail.com>.
for future reference e for someone who interest in this same subject (run
shell scripts) with rest request:

I am describe below what are working great for me now. It is a more simple
aprouch, but I am afraid I lost the batch feature because described by
Jean's post.

Although Its works, in the near future I will came back here to implement
the batch feature again and a more dinamically pattern as I am growing in
the learning camel.

I want to register my gratitude for the help and for the patience I found in
this this forum!



package br.edu.fzlbpms.template.camel.batch.impl;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

@Path("/")
public class ControllerService {

  @GET
  @Path("/start/{command}")
  @Produces("text/plain")
  public String startRoute(@PathParam("command") String command) throws
Exception {
	  return null;
  }
}


<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="rsServer" address="http://localhost:9090/batch"
	
serviceClass="br.edu.fzlbpms.template.camel.batch.impl.ControllerService"/>

  
  <camelContext xmlns="http://camel.apache.org/schema/spring">
    
    <route id="control">
        <from uri="cxfrs:bean:rsServer"/>
        
        <when>
            <simple>${body} == 'fzl_fuseide'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_fuseide.sh"/>
        </when>
        <when>
            <simple>${body} == 'fzl_open_gi'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_gi.sh"/>
        </when>
        <when>
            <simple>${body} == 'fzl_eclipse_juno'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_eclipse_juno.sh"/>
        </when>
        <when>
            <simple>${body} == 'fzl_open_birt_modeler'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_birt_modeler.sh"/>
        </when>        
        <when>
            <simple>${body} == 'fzl_open_pror'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_pror.sh"/>
        </when>                
        <when>
            <simple>${body} == 'fzl_start_apacheds_studio'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_start_apacheds_studio.sh"/>
        </when>
        <when>
            <simple>${body} == 'fzl_jmeter'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_jmeter.sh"/>
        </when>
        <when>
            <simple>${body} == 'fzl_open_soapui'</simple>
            <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_soapui.sh"/>
        </when>
        						                               
    </route>
  
  </camelContext>

</beans>





--
View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714250.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by wagner <wa...@gmail.com>.
as a beginner, sometimes (often) I make basic mistakes...

So, correcting myself.... (to me and to others that possibly read this post
in the future)

the "return commands;" is a no no. It must return null in order to not
permit ControllerService handle the request.








--
View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714232.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by wagner <wa...@gmail.com>.
Hi Claus, thanks for help. 

The greatest pattern for me now is the Routing Slip one,  because it could
act like a pipeline for exec: commands endpoints, as we used do with bash
command.


Buy what I can not still figure out is how to pass information from the rest
request from my ControllerService to my ControllerBean. 
I think this is important, because in this way, the ControllerBean could use
it to set the list of the exec endpoints that should receive the Exchange.


If I am corret with my thoughts, my very first issue now is get information
from the request and put it in the camel context for ControllerBean access
it.


So I try this:

@Path("/")
public class ControllerService {


  @GET
  @Path("/start") 
  @Produces("text/plain")
  public String startRoute(*@QueryParam("commands")* String *commands*)
throws Exception {
	  //here, I do not want to deal with this "hiphen delimeted" *commands*
string receive from the request
	  //I think this method is not for processing the request but just for a
acces pont for my batch executable commands
	  //But I hope to achieve a way to pass this string to my ControllerBean
	  //because ControllerBean will use this string to create the list of
endpoints the will receive the messages	
	  //and set it as a header for Routing Slipe implementation
	  
	  //I wandering if I return the *commands* string here, the ControllerBean
would can get from camelContext....
	  return commands;
  }

  I know that there are another changes to do for the Routing Slip pattern
implementation, but, for now, I would like to test my concepts by small
steps.


  Am I in the correct way? 


  All best wishes for the team!!! and many thanks!!!


 















--
View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714222.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You may take a look at the recipient list, routing slip, or dynamic
router EIP patterns in Camel. They are more dynamic than the content
based router.

You would then be able from a piece of Java code, to return a String
that contains the uri of the exec command.



On Wed, Aug 22, 2012 at 6:13 AM, wagner <wa...@gmail.com> wrote:
> Hi, thanks for remarks.
>
> Jean, I have been used camel-exec feature based on one of your posts:
> *http://blog.nanthrax.net/2011/08/use-camel-cxf-and-karaf-to-implement-batches/*
>
> So, I change route.xml properly, like below:
>   <camelContext xmlns="http://camel.apache.org/schema/spring">
>     <route id="control">
>         <from uri="cxfrs:bean:rsServer"/>
>         <to uri="controllerBean"/>
>     </route>
>     <route autoStartup="false" id="batch">
>         <from uri="controllerBean"/>
>         <to
> uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_gi.sh"/>
>         <process ref="stopProcessor"/>
>     </route>
>
> and works really great.
>
>
>
> But, my problem is that, in this way, I can execute just only one command
> (the fzl_open_gi.sh one), from http://localhost:9090/batch/start/ request.
>
>
> My wishes is to run commands based on a content-routed pattern like below:
>
>     <route autoStartup="false" id="batch">
>         <from uri="controllerBean"/>
>         <choice>
>             <when>
>                 <xpath>$body = 'bar_command'</xpath>
>                 <to uri="exec:/run/media/.../fzlbpms/bin/bar_command.sh"/>
>             </when>
>             <when>
>                 <xpath>$body = 'cheese_command'</xpath>
>                 <to
> uri="exec:/run/media/.../fzlbpms/bin/cheese_command.sh"/>
>             </when>
>             <otherwise>
>                 <to
> uri="exec:/run/media/.../fzlbpms/bin/default_command.sh"/>
>             </otherwise>
>         </choice>
>
>         <process ref="stopProcessor"/>
>     </route>
>
>
>     To achieve this, I think that the body message (produced by
> controllerBean handler method) should be produce the diferents commanda
> namea and not only the "batch" string.
>
>    Maybe my final question is: How to instruct controllerBean to produce a
> selective body message based on a diferent rest path like
>
> http://localhost:9090/batch/start/bar_command
> http://localhost:9090/batch/start/cheese_command
>
> Could you help me please?
>
> PS: If a failed to explain myself, please let me know.
>
> Best Regards
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714217.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by wagner <wa...@gmail.com>.
Hi, thanks for remarks.

Jean, I have been used camel-exec feature based on one of your posts: 
*http://blog.nanthrax.net/2011/08/use-camel-cxf-and-karaf-to-implement-batches/*

So, I change route.xml properly, like below:
  <camelContext xmlns="http://camel.apache.org/schema/spring">
    <route id="control">
        <from uri="cxfrs:bean:rsServer"/>
        <to uri="controllerBean"/>
    </route>
    <route autoStartup="false" id="batch">
        <from uri="controllerBean"/>
        <to
uri="exec:/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/bin/fzl_open_gi.sh"/>
        <process ref="stopProcessor"/>
    </route>

and works really great. 



But, my problem is that, in this way, I can execute just only one command
(the fzl_open_gi.sh one), from http://localhost:9090/batch/start/ request.


My wishes is to run commands based on a content-routed pattern like below:

    <route autoStartup="false" id="batch">
        <from uri="controllerBean"/>
        <choice>
            <when>
                <xpath>$body = 'bar_command'</xpath>
                <to uri="exec:/run/media/.../fzlbpms/bin/bar_command.sh"/>
            </when>
            <when>
                <xpath>$body = 'cheese_command'</xpath>
                <to
uri="exec:/run/media/.../fzlbpms/bin/cheese_command.sh"/>
            </when>
            <otherwise>
                <to
uri="exec:/run/media/.../fzlbpms/bin/default_command.sh"/>
            </otherwise>
        </choice>

        <process ref="stopProcessor"/>
    </route>


    To achieve this, I think that the body message (produced by
controllerBean handler method) should be produce the diferents commanda
namea and not only the "batch" string. 

   Maybe my final question is: How to instruct controllerBean to produce a
selective body message based on a diferent rest path like
 
http://localhost:9090/batch/start/bar_command
http://localhost:9090/batch/start/cheese_command

Could you help me please?

PS: If a failed to explain myself, please let me know. 

Best Regards



--
View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714217.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Agree with Freeman,

if you start from scratch, Camel is the good choice.

Anyway, I gonna take a look on servicemix-exec as it should work ;)

Regards
JB

On 08/11/2012 06:53 AM, wagner wrote:
>
> thanks Freeman,
>
> Testing the result by command "features:list | grep exec", a discovered
> camel-exec.
> Allthough the success of servicemix-exec feature installation, I realized
> that camel-exec is more productive to me.
>
> What a great software is servicemix and its features!!!
>
> Best regards
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714134.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by wagner <wa...@gmail.com>.
thanks Freeman,

Testing the result by command "features:list | grep exec", a discovered
camel-exec. 
Allthough the success of servicemix-exec feature installation, I realized
that camel-exec is more productive to me. 

What a great software is servicemix and its features!!!

Best regards 



--
View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116p5714134.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: how to intall servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

servicemix-exec not get shipped with FUSE ESB by default.
However you can re-enable it.

edit
./system/org/apache/servicemix/apache-servicemix/4.4.1-fuse-07-11/apache-servicemix-4.4.1-fuse-07-11-features.xml

uncomment out servicemix-exec feature, then from the console you can use "features:install servicemix-exec" to install it, you need internet connection.

Btw, as this is FUSE ESB specific version, so could you please post this kind of question to fuse forum[1]? Thanks
[1]http://fusesource.com/forums/index.jspa

Freeman
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-10, at 下午1:08, wagner wrote:

> 
> Hi
> 
> How to install servicemix-exec in apache-servicemix-4.4.1-fuse-07-11?
> 
> Best Regards
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/how-to-intall-servicemix-exec-in-apache-servicemix-4-4-1-fuse-07-11-tp5714116.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.