Question

We're migrating an application from an older gridgain 4 codebase to gridgain 6. In the old application, we partitioned the nodes based on the grid attribute key "com.mycompany.workgroup" . The new release doesn't have a topologySpi configuration property or GridAttributesTopologySpi .

  1. What is the recommended approach or alternative?

  2. Do any of the supplied examples address my requirement? Maybe I missed something when browsing through them.

Thanks

<beans profile="default">

    <bean id="workerGrid"
          class="org.gridgain.grid.GridSpringBean">
        <property name="configuration">
            <bean parent="abstractGridConfiguration">
                <property name="gridName" value="${grid.name}-worker"/>
                <property name="userAttributes">
                    <map merge="true">
                        <entry key="com.mycompany.master" value="false"/>
                    </map>
                </property>
                <property name="topologySpi">
                    <bean class="org.gridgain.grid.spi.topology.attributes.GridAttributesTopologySpi">
                        <property name="attributes">
                            <map>
                                <entry key="com.mycompany.workgroup" value="${grid.workgroup}"/>
                            </map>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
Was it helpful?

Solution

The alternative is to use GridProjection, like so

Grid grid = GridGain.grid();

GridProjection prj = grid.forAttribute("com.mycompany.workgroup", "workers");

GridComputeTaskFuture<?> fut = prj.compute().execute(new MyTask());

// Synchronous wait.
prj.get();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top