2 Replies Latest reply on Jun 22, 2006 6:59 AM by Jeff Lowcock

    EJB @Service Attribute/Property setting

    Jeff Lowcock Newbie

      I'm trying to create a JBoss service which is a member of a virtual cluster. Where more than one virtual cluster can be deployed on the same JBoss server e.g. Development and Acceptance.
      I want to unique name my Service with a combination of the Cluster and Member name, something like development.myservice and acceptance.myservice.
      Hence I would like to use the same class, and configure this using attributes and/or properties similar in concept to the older service.xml.
      I cannot find any examples of a configurable service, can anyone assist in this area?

        • 1. Re: EJB @Service Attribute/Property setting
          William DeCoste Apprentice

          I think I understand your question - if I'm off base please let me know.

          You can use the same Service class and deploy it twice with different service names two ways:

          Use annotations to deploy the first and jboss.xml to deploy the second

          @Service(objectName = "default:service=development")
          ...
          


          <service>
           <ejb-name>ServiceName</ejb-name>
           <ejb-class>com.acme.ServiceBean</ejb-class>
           <object-name>default:service=acceptance</objectname>
           ...
          <service>
          


          OR you can use jboss.xml exclusively with no annotations:


          <service>
           <ejb-name>ServiceName</ejb-name>
           <ejb-class>com.acme.ServiceBean</ejb-class>
           <object-name>default:service=development</objectname>
           ...
          <service>
          <service>
           <ejb-name>ServiceName</ejb-name>
           <ejb-class>com.acme.ServiceBean</ejb-class>
           <object-name>default:service=acceptance</objectname>
           ...
          <service>
          
          




          • 2. Re: EJB @Service Attribute/Property setting
            Jeff Lowcock Newbie

            This is close, it shows how to deploy the same class as two separately identified services which is half the problem. The issue I'm facing is how do I access the details of ejb-name and service/cluster name within the Service code. I need this information to form the primary key of an EJB entity class to load configuration from the database.
            I suppose that there is a way to access the information with the xml file, I'll go away and have a look at this as well.
            I was looking for something along the lines of the env-entry within the deployment descriptor.