Integration of IceBox with IceGrid & Glacier2 & IcePatch2 with Java Services

janosjanos GermanyJanos VeresOrganization: feat.Me Networks, Inc.Project: An offline social interaction platform.Member
edited July 2016 in Help Center

Hello!

I ended up with a more complex setup, than I set out to implement. I'd like to verify the concept before starting testing and everything falls apart.
The Glacier2, IcePatch2 is working and tested, therefore I omitted the configuration of those.
My question is more about integration of IceBox into a routed IceGrid environment.

I'm sorry for the many question, before testing any actual code, but I believe it just doesn't make sense to implement it, if it's conceptually wrong.

  1. Is this configuration correct and the system can understand it?:
<icegrid>
   
    <application name=“IceGrid-Dev">
    
        <replica-group id="Backend" filter="filterByRegion">
     
            ...
        </replica-group>

    
        <!-- ServiceProvider Template -->
 
        <server-template id="Provider">
   
            ...
        </server-template>

     
        <server-template id="IcePatch2">
  
            ...
        </server-template>

   
        <server-template id="Glacier2">
  
            ... 
        </server-template>

     
        <service-template id="ServiceTemplate">
    
            <parameter name="name"/>
      
            <parameter name="entryPoint"/>
     
            <parameter name="objIdentity"/>
            <parameter name="objType"/>
            <service name="${name}" entry="${entryPoint}">
   
                <adapter name="${service}" endpoints="default">

                    <object identity="${objIdentity}" type="${objType}"/>
                </adapter>
                <property name="${service}.Identity" value="${server}-${service}"/>
   
                <!-- IceGrid connection -->
  
                <property name="Ice.Default.Locator" value="${application}/Locator:tcp -h localhost -p 5064"/>
    
            </service>

        </service-template>

   
        <node name="node1”>
            <server-instance template="Glacier2"
 client-endpoints="ws -p 8111 -h localhost -r /bws:tcp -p 8110 -h localhost”
 session-timeout="300"
 server-endpoints="tcp -h localhost" />

  
            <server-instance template="IcePatch2" directory=“/path/to/serverdata"/>
            
<icebox id="IceBoxServer" endpoints="default" exe="java" activation="always">
      
                <option>IceBox.Server</option>
   
                <service-instance template="ServiceTemplate" name=“MyService” entryPoint="::com::full::path::to::MyService” objIdentity="MyServiceObject" objType="::com::full::path::to::MyServiceObject"/>
                <!-- server distribution contains environment -->
                <distrib icepatch="${application}.IcePatch2/server">
  
                    <directory>services/dev</directory>
     
                </distrib>
            </icebox>
      
        </node>
   
    </application>

</icegrid>

  1. Can a well-known object be registered from the service-template, the way shown in the above configuration?

  2. How would one get a proxy in the client to the MyServiceObject?
    My assumption would be (code is in javascript):

function getMyServiceFooResponse(param1, param2) {
    const setup = new Ice.Promise();
    Ice.Promise.try(
        function () {
            return MyServiceObjectPrx.checkedCast(_communicator.stringToProxy('[email protected]"));
        }
    )
    .then(
        function (myServiceObjectProxy) {
            return myServiceObjPrx.foo(param1, param2);
        }
    )
    .then(
        function (fooResponse) {
            setup.succeed(fooResponse);
        }
    )
    .exception(
        function (ex) {
            setup.fail(ex);
        }
    );
    return setup;
}
  1. Is communicator.stringToProxy(s) looking for the proxy through the Glacier2's Locator (is it also a routed request)?

  2. Does the IcePatch2 distrib configuration within the <icebox> applied above ensure that the <server-instance> finds the deployed .jar file for the service? Where should the .jar files be deployed for icebox? Or do I need to change the entry to represent the deployment path as well, something along the way of: ./services/dev/::com::full::path::to::MyService?

  3. In general, does the <adapter> and <service-template> support replica-group, the same way as the <adapter> within a <server-template> tag does? So having a config with:

<icegrid>
<application>
<replica-group id="Services" filter="filterByRegion">
    <description>Development Environment access to Backend Services</description>
    <load-balancing type="adaptive" load-sample="1" n-replicas="0"/>
    <object identity="MyServiceObject" type="::MyService::MyServiceObject"/>
</replica-group>
...
<service-template id="ReplicatedServiceTemplate">
    
    <parameter name="name"/>
      
    <parameter name="entryPoint"/>
     
    <parameter name="regions" default="EUW,EUC"/>
    <service name="${name}" entry="${entryPoint}">
   
    <adapter name="${service}" endpoints="default"/>

    <property name="${service}.Identity" value="${server}-${service}"/>
   
    <!-- IceGrid connection -->
  
    <property name="Ice.Default.Locator" value="${application}/Locator:tcp -h localhost -p 5064"/>
    
    </service>

</service-template>

   
...
<node>
<icebox>
    <service-instance template="ReplicatedServiceTemplate" name=“MyService” entryPoint="::com::full::path::to::MyService”/>
</icebox>
<node>
</application>
</icegrid>

would mean, that the proxy can be retrieved with _communicator.stringToProxy("[email protected]");. Is this assumption correct?

Thanks a lot, I appreciate the time you took to read through!

Best Answer

  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Accepted Answer

    Hi,

    To answer your questions:

    1. The stringToProxy method doesn't trigger any remote invocations under the hood, it's just a method to convert the string to an Ice proxy object. When invoking on this proxy object, the client will forward the request to Glacier2 and Glacier2 will resolve the endpoints associated with the proxy using its Ice locator configuration. Since you register a well-known object, you can just use stringToProxy("MyServiceObject"), you don't need to specify the adapter ID with @IceGrid-Dev-MyService. See https://doc.zeroc.com/display/Ice36/Well-Known+Objects.
    2. Yes, you need to specify the path of the JAR file in the entry point if the Jar file is not available on the class path of the IceBox server, see https://doc.zeroc.com/pages/viewpage.action?pageId=14031638#IceBox.*-IceBox.Service.name for information on how to specify the entry point for Java IceBox servers.
    3. You're correct, replica groups work the same way for services or servers. Note that you will need to add the replica-group="Services" attribute to the <adapter> element of your service template if you want the adapter to participate.

    Cheers,
    Benoit.

Answers

  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    Accepted Answer

    Hi,

    To answer your questions:

    1. The stringToProxy method doesn't trigger any remote invocations under the hood, it's just a method to convert the string to an Ice proxy object. When invoking on this proxy object, the client will forward the request to Glacier2 and Glacier2 will resolve the endpoints associated with the proxy using its Ice locator configuration. Since you register a well-known object, you can just use stringToProxy("MyServiceObject"), you don't need to specify the adapter ID with @IceGrid-Dev-MyService. See https://doc.zeroc.com/display/Ice36/Well-Known+Objects.
    2. Yes, you need to specify the path of the JAR file in the entry point if the Jar file is not available on the class path of the IceBox server, see https://doc.zeroc.com/pages/viewpage.action?pageId=14031638#IceBox.*-IceBox.Service.name for information on how to specify the entry point for Java IceBox servers.
    3. You're correct, replica groups work the same way for services or servers. Note that you will need to add the replica-group="Services" attribute to the <adapter> element of your service template if you want the adapter to participate.

    Cheers,
    Benoit.

Sign In or Register to comment.