Showing posts with label ServiceMix. Show all posts
Showing posts with label ServiceMix. Show all posts

Friday, April 13, 2012

3 reasons to use FuseSource Documentation

As an Apache Committer but also FuseSource Consultant and Solution Architect, the documentation and its quality is a critical factor in my day by day work. Until now, even using google search engine, that was difficult to find in one place all the information required and a wasting time.
This situation has changed and I will give you three reasons to use/adopt FuseSource documentation for your Apache Camel, Apache ServiceMix and Apache Karaf projects.


Reason 1 :  Fuse maintains history of Apache releases
Apache websites uses Atlassian Confluence to maintain content publishes for each Apache project. This tool does not allow to create a history of the different releases of Camel by example (2.6, 2.7, 2.8). This is not the case with FuseSource documentation which allow you to browse a specific version like the current. And with the help of google, you can make specific search like that
    site:fusesource.com/docs/router/2.8/ "followed by the keywords"
or 
    site:fusesource.com/docs/router "followed by the keywords"

Reason 2 : Javadoc and Schema are well documented
Javadoc like XML Schema are also 2 interesting examples as there is no XML Schema javadoc on Apache websites for by example Spring DSL language. This is completely different on FuseSource web site as you can read the documentation and discover what are the tags or attributes to be used for specific Apache Camel DSL words. Here is an example containing the options proposed for Apache Camel Dataformat.
     http://fusesource.com/docs/router/2.8/xmlref/http.camel.apache.org.2033734988/element/dataformats.html





Reason 3 : New chapters have been added
FuseSource documentation contains missing pieces of information or cover in depth points which are described poorly on Apache websites or in an disparate way. So take the time to read the following chapters when you need more info about Transactions, Security, ...

  • Camel and Transactions : http://fusesource.com/docs/router/2.8/transactions/front.html
  • Camel and WebServices : http://fusesource.com/docs/router/2.8/camel_cxf/front.html
  • Fuse ESB - Security guide : http://fusesource.com/docs/esb/4.4.1/esb_security/front.html
  • Transactions with Fuse ESB : http://fusesource.com/docs/esb/4.4.1/camel_tx/front.html
  • ActiveMQ - Security : http://fusesource.com/docs/esb/4.4.1/amq_security/front.html
  • ActiveMQ - Tuning Guide : http://fusesource.com/docs/esb/4.4.1/amq_tuning/front.html
____________________________






Friday, December 16, 2011

Run a Google Web Toolkit 2 project on Apache Karaf/ServiceMix

To simplify the development of Web projects on Apache Karaf/Apache ServiceMix, we have created archetypes to setup WAR or WAB projects. They are very basic but they can be enriched with framework like Struts 2, Wicket, plain JSP or MyFaces JSF as they are currently supported on Apache Karaf - ServiceMix.

For the GWT users, it exists now an archetype which will create a GWT 2.4 project. To create such a project, you must generate a project from the archetype

mvn archetype:generate \
   -DarchetypeGroupId=org.ops4j.pax.web.archetypes\
   -DarchetypeArtifactId=wab-gwt-archetype \
   -DarchetypeVersion=2.1.2 \
   -DgroupId=com.mycompany \
   -DartifactId=hello \
   -Dversion=1.0



build next the WAB using hello/mvn clean install

and deploy it on Apache Karaf



Verify that the web site is well registered :



Next, you can navigate to your application in your browser and click on the button to say Hello.




Remark : A WAB project is nothing more than a WAR excepted it is packaged as a bundle file, that we have removed the WEB-INF/lib dependencies and create a MANIFEST file containing the OSGI instructions.


Monday, March 30, 2009

Trick to customize war deployment on ServiceMix4 using PAX

Here is another very interesting trick that you can use to customize the war the deployment process on ServiceMix.

customize = in this context, this word means How can I add property or extend existing of a MANIFEST file

e.g. : The WAR to be deployed contains tlb files created under the folder WEB-INF/tags/form and WEB-INF/tags/jms. By default PAX will create a MANIFEST file containing the property Bundle-Classpath with :
  • WEB-INF/classes
  • all jars from WEB-INF/lib directory
but will not take care about your folders

Two possibilities are available to tell to PAX that it must include in the Bundle-Classpath your folders

1) Command + uri

This one consists in to pass the parameters as an uri like this :

install war:file:///d:/temp/activemq-web-console-5.2.0.war?Bundle-Classpath= ., WEB-INF/tags/form, WEB-INF/tags/jms&Webapp-Context= activemqweb

2) Create a file.bnd + command

Another interesting option is to provide as a file the location of the WAR and the properties that you want to add
  • Create a file called xxxx.bnd
  • Add in the file the following lines :
WAR-URL=file:///c/temp/activemq-web-console-5.2.0.war
Bundle-Classpath=., WEB-INF/tags/form, WEB-INF/tags/jms
Webapp-Context=activemqweb
  • use in your favorite OSGI server (ServiceMix) the following command to install the WAR :
install war-i:file:///c:/temp/activemq-web-console-5.2.0.bnd

Friday, March 27, 2009

ServiceMix 4 as a Web Application Server

This week, I have discovered the web possibilities offered by the ServiceMix 4 platform. SMX ("pour les intimes") uses as its core platform the excellent packages of the project PAX which is the umbrella project for all OSGi bundles and tools.

In standard, the following bundles are installed :

[ 9] [Active ] [ ] [ 8] OPS4J Pax Logging - API (1.3.0)
[ 10] [Active ] [ ] [ 8] OPS4J Pax Logging - Service (1.3.0)
[ 11] [Active ] [ ] [ 5] OPS4J Pax Url - wrap: (0.3.3)
[ 12] [Active ] [ ] [ 5] OPS4J Pax Url - mvn: (0.3.3)

They are used to log information of the server and to install or wrap bundles. Nevertheless, PAX project is not limited to the mentioned bundles but proposes also Web support for jetty.

To install or transform ServiceMix as a Web Application Server, you can use the "web" and "web-core" feature (available under ServiceMix 4) or install the following bundles manually :

- OPS4J Pax Web - Web Container (0.5.2)
- OPS4J Pax Web - Jsp Support (0.5.2)
- OPS4J Pax Web Extender - WAR (0.5.0)
- OPS4J Pax Web Extender - Whiteboard (0.5.0)
- OPS4J Pax Url - war:, war-i: (0.3.3)
- Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)

The Web Application Server becomes available at the url http://localhost:8080.

Evidently, no jsp pages, servlets are available. Don't worry, to deploy a WAR, you only have to copy it to the deploy directory of ServiceMix and it will convert be converted as a bundle

By example, you can install a simple Hello World war using the command

install war:file:///d:/temp/sample.war?Webapp-Context=sample

remarks :
- file:/// must be changed according to the location of your war
- The parameter WebApp-Context is added to have a nicer web address

and see the result at the address : http://localhost:8080/sample/index.html

Yes, this looks beautiful but the web port number is 8080, my boss would like to secure the web site, change the session timeout, ....

This is very simple to do, you create a file named (org.ops4j.pax.web.cfg) and copy it in the directory etc of servicemix, in this file you can parametrize by example the following properties (see PAX for more information) :

org.osgi.service.http.port=80
org.ops4j.pax.web.session.timeout=10


You restart Servicemix and now the web site is available at the following address :

http://localhost/sample/index.html

Tuesday, March 17, 2009

Can Apache Camel be independent of the queuing engine ?

Designing and deploying an Apache Camel project in an environment where you have (as an administrator) the control is something very simple to do. Most of the time, the code that you will receive from the developers will be ready to be deployed on the server (ServiceMix, J2EE, ...).

But this is not the case, when you work in big companies where the infrastructure is separated from the teams in charge to design/build/deploy and release the application. As a developer you don't have access to the acceptance or production environment. This means that you must provide different configuration files to the builder team and/or release management in order to deploy your application in development, acceptance and production environment.

Obviously, the name of the servers are not the same and the infrastructure is in charge to manage the queues servers. In this environment, infra will never accept that the queues definition or creation of the queuing engine are under the responsibility of the developer(s). Thus, it will not be possible in your spring DSL file (or Camel Java DSL classes) to declare your queuing engine like this :

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
<property name="brokerURL" value="vm://localhost:61616" / >
</bean >

remark: vm://localhost:61616 must be changed to serverName.intranet.domainName:port
depending on queuing engine deployed in the different environment.

To make Camel independent of its queuing engine :
  • ActiveMq,
  • WebSphereMQ,
  • SonicMq,
  • TIBCO,
  • ...
and parameters like :
  • Size of the queue,
  • Size of the messages accepted on the queue,
  • Persistence of the messages
  • ...
you must made different modifications. Let's assume that you plan to use ActiveMq as your queuing engine. Here is the list of the modifications to do :

1) Add the required bundles to your ServiceMix 4 osgi server to allow it to work with ActiveMq. Normally, the features transaction and activemq are activated by default in the file etc/org.apache.servicemix.features.cfg. So, you don't have to do anything else except if you use ServiceMix Kernel. In this case, you have to add the bundles manually or add a link (in the config file) to the features.xml file where the bundles have been declared

2) Create a spring xml file where the parameters of the queuing engine are defined. Luckily, such a file already exists and is available from Apache ServiceMix 4 project. So, copy the file into the deploy folder of ServiceMix 4 or Servicemix 4 Kernel

3) Create a osgi-queueservice.xml file containing the following lines and copy it in the deploy folder of ServiceMix

<?xml version="1.0" encoding="UTF-8"? >
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

<bean id="active-mq" class="org.apache.activemq.camel.component.ActiveMQComponent" />

<osgi:service id="osgiqueuingservice" ref="active-mq" interface="org.apache.camel.Component"/>

</beans>

When the spring file will be at the server startup loaded by Spring (though its Application context), it will create the bean "active-mq" and instantiate the class : org.apache.activemq.camel.component.ActiveMQComponent.

Remarks :
- No parameters are provided to the ActiveMqComponent like brokerUrl, ...
- If you need to work with another JMS queuing engine, you can replace the class ActiveMQComponent by : org.apache.camel.component.jms.JmsComponent

Next it will create an OSGI service called "osgiqueuingservice" and expose it through the interfaces : org.apache.camel.Component

Remark : As JmsComponent, ActiveMqComponent implements this interface, the OSGI service is generic. So you could parameterized it using a property file (cfg file in the ServiceMix world)

4) The last step is very simple. In your camel config file, you add a reference to your osgi service in order to retrieve the queuing engine like this :

<osgi:reference id="queuingservice" interface="org.apache.camel.Component" />

Please remark that you import the Component interface. So, Camel becomes independent of the queuing engine used (WebSphere, TIBCO, ActiveMQ, ...)

and in your Camel route :

<camel:from uri="queuingservice:queue:in" />

Wednesday, March 11, 2009

How to share connection pool - OSGI- SMX4

Here is an interesting article published on the blog of Adrian Tranaman showing How to share a connection pool between OSGI bundle.

Tuesday, December 9, 2008

Tutorial introducing How to create, design a simple SOA solution using Camel and OSGI

After a few weeks of investigation about OSGI, I have decided to start to write a tutorial showing How we can design/create a Service Oriented Architecture using Camel in combination with OSGI standard. The first part of this tutorial has been published and next part will come soon.

Through this tutorial, the user will see how such a solution can be designed and deployed in two really interesting products : ServiceMix Kernel server (based on Apache Felix) and Spring Dynamic Server (based on Eclipse Equinox).

Link : http://cwiki.apache.org/confluence/display/CAMEL/tutorial-osgi-camel-part1