service unit

Upload: ukani-yogesh

Post on 09-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 service unit

    1/3

    Endpoints,Service Units and ComponentsServicemix allows deployments in the one of the two following modes

    y Standard JBI modey Lightweightmode

    Refer this link to get to know what these modes mean.We will look at the Standard JBI way of installing components in this post.The JBI specification uses the following terminology Service Unit, Service Assembly,Component,Endpoint and Service.One needs to understand clearly what each of themmean, so here is some help

    1. Component:-- The primary purpose of the components in an ESB is to let theservices interact with the NMR and vice versa.The closest analogy that I candraw on the interaction between the component and heart of the ESB, the NMRis that of the device driver and the CPU in a computer. Just as the Device

    driver is responsible for understanding what action what performed on andwhat data is provided by the connected device(say a floppy disk), thecomponent is responsible for allowing the NMR to interface with the external ofinternal service.

    (For example the Servicemix-jms component is responsible for reading messagesfrom /adding messages to a JMS queue to which is configured.)

    Components can be of one of the two types following types

    1. Service Engines2. Binding Components( All the references to 'Components' going forward in

    this post are references to Binding Components)

    2. Endpoints:-- Components, as explained earlier, donot provide services or databy themselves.They allow the NMR to interface with the services.Services that need to be accessed by the ESB are accessed asendpoints.Endpoint is how a service is addressed by the ESB.

    Using the same analogy that we have used earlier, the endpoint is the location

    of the device(printer or floppy drive) that is to be accessed by the CPU usingthe device driver

    3. Service:- Service is the actual business entity the performs the desiredfunction. In our analogy, the service is the printer or the floppy drive thatactually does the work or printing or providing data. Example for a service canbe a web service or a EJB component that needs to be accessed by ESB. Aservice is accessed by the ESB using the address specified in the endpoint. In

  • 8/7/2019 service unit

    2/3

    service mix endpoint information can be expressed in a xbean.xml file.(Refer this link for a sample xbeans.xml file)

    4.Service Unit: Service units provide information about the services and theirendpoints to the component.In our analogy, service units deploying a serviceunit is similar configuring the device type,make and location information forthe driver. In the context of components and service units,note the following

    Components are installed

    Service units are deployedon to installed components .

    The components on which service units are deployed are the called targetcomponents for the respective service units.

    5. Service Assembly: Service assembly is how several service units are packagedand deployed on to target components.The service assembly is a archive filethat contains a JBI.xml file that provides information about the service unitsand their respective target components.Here is an excerpt of the JBI.xml filethat is used in the service assembly. [target][artifacts-zip]sample-su.zip[/artifacts-zip][component-name]servicemix-http[/component-name][/target] (* I have used []instead of to have text ignored by blogger)

    in this excerpt you can see that service unit sample-su.zip is being deployed onservicemix-http component( the target).

    Now that we have the jargon clarified, lets look at what one actually will have to doto make a service accessible using servicemix?

    1. Define your service as an endpoint in an xbeans.xml file(Refer the XBeandeployment section ofhttp://servicemix.org/site/servicemix-jms.html for asample of endpoint configuration for JMS)

    2. Create a service unit by adding the xbeans.xml file to a zip file(sayserviceunit.zip).

    3. Create a jbi.xml as specified in step 2 under Manually Creating a Service Unitand Service Assembly section in this article.Create a service assembly byadding the jbi.xml created,serviceunit.zip created in step 2 (above) to a zipfile(say serviceassembly.zip)

  • 8/7/2019 service unit

    3/3

    4. Place the serviceassembly.zip in the deploy directory under {servicemixhome}/bin directory (Note that servicemix-jms component will have toinstalled before you deploy the service assembly)

    5. Check for the endpoint deployment using the JMX console.A node is displayedas added under the endpoint node.