What's the alternative to GridAttributesTopologySpi in GridGain 6 (open source version)

StackOverflow https://stackoverflow.com//questions/23023659

  •  21-12-2019
  •  | 
  •  

문제

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>
도움이 되었습니까?

해결책

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top