Thursday, November 3, 2016

Fuse 6.3.0 Better Way to Start as a Service

With License restrictions around Tanuki Wrapper limiting the memory that can be allocated to Jboss Fuse was limited to more than 4GB.Users adopted a slew of different ways to start Jboss fuse as service but none was provided with the product till now. Fuse 6.3 has now decided to deprecate the wrapper service and has instead provided a set of scripts under $FUSE_HOME/bin/contrib for different operating systems to start and stop the Fuse application as service
For RHEL 7 you can follow the below steps to start stop the Jboss Fuse application as Service
  • Open the file karaf-service-template.systemd
  • Change the filepaths pointing to the server as needed

[Unit]
Description=fuse63
After=syslog.target network.target

[Service]
EnvironmentFile=/home/jboss/jboss-fuse-6.3.0.redhat-187/bin/setenv

ExecStart=/home/jboss/jboss-fuse-6.3.0.redhat-187/bin/fuse daemon
ExecStop=/home/jboss/jboss-fuse-6.3.0.redhat-187/bin/fuse stop

User=jboss
Group=jboss

SuccessExitStatus=0 143
RestartSec=15
Restart=on-failure

LimitNOFILE=102642

[Install]
WantedBy=multi-user.target


  • Change to root , Move the file to /usr/lib/systemd/system/jbossfuse.service
  • run the command systemctl daemon-reload
  • If you also want Fuse to start on reboot of the servers issue the command systemctl enable jbossfuse
  • now you should be able to run the commands
    • systemctl status jbossfuse
    • systemctl start jbossfuse
    • systemctl stop jbossfuse
  • I had rushed in to create the blog looking at the scripts in the contrib directory , here is the cleaner way to do the above steps with official documentation , however with a little help for child containers.
       

    For RHEL 7 you can follow the below steps to start stop the Jboss Fuse application as Service

    • Navigate to the #FUSE_HOME/bin/contrib directory.
    • Run the script karaf-service.sh with parameters as described here.
      • karaf-service.sh -k $FUSE_HOME -n rootservicename.
    • It generates two files rootservicename.service and rootservicename@.service .
    • The rootservicename@.service is the template for child containers.
    • Suppose you have a child container named child1.
    [ Need to review further , consider this work-around ]
    • Copy the file rootservicename@.service to /etc/systemd/system as rootservicename@child1.service.
    • Edit the file and change the EXEC_START line to point to the admin script as below.  ( the default script somehow does not start the child containers , though all the parameters are set )
      • ExecStart=/home/jboss/fuse/jboss-fuse-6.3.0.redhat-187/bin/admin start %i
      • ExecStart=/home/jboss/fuse/jboss-fuse-6.3.0.redhat-187/bin/admin stop %i
    • Excute the command systemctl daemon-reload ( to apply the changes )
    • Once you enable the service on systemctl , the child container child1 can now be controlled via systemctl commands , the script will restart the root container before the child assuming that the root container is not running .


    Tuesday, November 1, 2016

    Fuse on EAP

    Camel on EAP is now at the latest and greatest version of 2.17 of camel and perhaps is a great way to get started and loaded with all features. The below components are by default available in the EAP subsystem once fuse is installed.
    camel-core, camel-activemq, camel-atom, camel-bindy, camel-braintree, camel-castor, camel-cdi, camel-cyrpto, camel-csv, camel-cxf, camel-dozer, camel-ejb, camel-elasticsearch, camel-flatpack, camel-ftp, camel-groovy, camel-hl7, camel-http, camel-http4, camel-jackson, camel-jasypt, camel-jaxb, camel-jgroups, camel-jms, camel-jmx, camel-jpa, camel-kafka, camel-ldap, camel-lucene, camel-mail, camel-main, camel-mina2, camel-mqtt, camel-mvel, camel-netty4, camel-ognl, camel-protobuf, camel-quartz2, camel-restlet, camel-rss, camel-salesforce, camel-saxon, camel-script, camel-servlet, camel-smpp, camel-soap, camel-spring, camel-sql, camel-stream, camel-swagger, camel-tagsoup, camel-velocity, camel-weather, camel-xmlbeans, camel-xmlsecurity, camel-xstream, camel-zipfile, camel-zookeeper.

    Advantages of the sub-system
    • Individual applications need not be patched.
    • No Necessity of fat war's , all the required dependencies are shipped with the server.
    • Better control on versions and support for the applications.
    There are multiple ways to boot-strap a camel context in EAP making it adaptable and easy for different developers to migrate without losing the ability to code in their own style.

    • With the camel context spring xml.
    • Jndi Bootstrap.
    • Simple Registry Bootstrap.
    • RouteBuilder mode (with CDI ).
    • Including routes in the domain.xml or standalone.xml.
    • With Spring-web ( not included in the module and hence will require a library addition to the application ).
    I have put together a small project which demonstrates the use of these methods to get you started with your first applications in EAP. To run these projects you would need the below
    1. Jboss EAP 6.4.10 patched with Jboss Fuse 6.3.0.
    2. Maven 3.0 and above.
    3. A IDE , preferably JBDS 9.1 GA or 10
    For Code examples please check here ..