Thank you so much John! It was really helpful :)

Regards,
- Dharam Thacker


On Fri, Oct 5, 2018 at 12:00 AM John Blum <[email protected]> wrote:

> Hi Dharam-
>
> Yes, CacheServer.setGroups(:String[]) [1] has been deprecated since
> Pivotal GemFire 7.0 (well before Apache Geode's time) in favor of the
> gemfire.groups System property [2].
>
> There are many ways to define this property.
>
> 1) You can set the gemfire.groups property as a Java System property when
> launching your Spring (Boot) configured/bootstrapped Apache Geode server,
> as follows:
>
> java -server -cp ... -Dgemfire.groups=A,B,C ...
>
> 2) You can set the groups using the @EnableGemfireProperties annotation
> as you have shown above.
>
> @SpringBootApplication
> @CacheServerApplication
> @EnableGemfireProperties(groups = "A,B,C")
> public class MyBootGeodeServerApplication { ... }
>
>
> 3) You can configure the groups using the PeerCacheConfigurer callback,
> like so...
>
> @SpringBootApplication
> @CacheServerApplication
> public class MyBootGeodeServerApplication {
>
>   public static void main(String[] args) {
>     ...
>   }
>
>   @Bean
>   PeerCacheConfigurer groupConfigurer(@Value(
> "${example.app.gemfire.groups:DefaultGroup}") String groups) {
>     return (beanName, cacheFactoryBean) ->
> cacheFactoryBean.getProperties().setProperty("groups", groups);
>   }
> }
>
> 4) When using the new *SBDG* project, there is a new annotation for
> setting groups, the *@UseGroups* annotation [4], for example...
>
> @SpringBootApplication
> @CacheServerApplication
> @UseGroups({ "A", "B", "C" })
> public class MyBootGeodeServerApplication {
>
>   public static void main(String[] args) {
>     ...
>   }
>
> Also see this...
>
>
> https://github.com/spring-projects/spring-boot-data-geode/blob/master/spring-geode/src/test/java/org/springframework/geode/config/annotation/GroupsConfigurationIntegrationTests.java#L65
>
>
> *#3* above is your best bet for configuring "groups" dynamically, since
> you can define the "example.app.gemfire.groups" (or any property name of
> your choosing) in different *Spring Boot* application.properties files,
> even properties enabled enabled via a Spring profile.
>
> For example, when running...
>
> $ java -server -cp ... -Dspring.profiles.active=profileOne ...
>
>
> And you have the following application properties files...
>
> application.properties
> application-profileOne.properties
> application-profileTwo.properties
> ...
>
> Where...
>
> #application.properties
> spring.application.name=TestServer
>
> #application-profileOne.propertieds
> example.app.gemfire.groups=A,B,C
>
> #application-profileTwo.properties
> example.app.gemfire.groups=D,E,F
>
>
> Then both the application.properties and application-profileOne.properties
> are applied, and you server will be in groups "A,B,C".  '
> spring.profiles.active' takes a comma-delimited list of profiles to
> enable.
>
> See Spring Boot doc [5] for more details.
>
> Hope this helps!
>
> Regards,
> John
>
>
> [1]
> http://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/server/CacheServer.html#setGroups-java.lang.String:A-
> [2]
> http://geode.apache.org/docs/guide/16/reference/topics/gemfire_properties.html
> [3]
> https://docs.spring.io/spring-data/geode/docs/current/api/org/springframework/data/gemfire/config/annotation/EnableGemFireProperties.html#groups--
> [4]
> https://docs.spring.io/autorepo/docs/spring-boot-data-geode-build/1.0.0.BUILD-SNAPSHOT/api/org/springframework/geode/config/annotation/UseGroups.html
> [5]
> https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-profile-specific-properties
>
>
> On Thu, Oct 4, 2018 at 7:36 AM, Thacker, Dharam <
> [email protected]> wrote:
>
>> Hi John,
>>
>>
>>
>> Could you suggest any way to dynamically set groups property using 
>> *“spring-data-geode
>> 2.1.0.RELEASE”*?
>>
>>
>>
>> Initially I thought to use “serverGroups” using CacheServerConfigurer but
>> it complains for deprecation. It’s very useful property to be set using
>> dynamic way.
>>
>>
>>
>> @*EnableGemFireProperties*(enableNetworkPartitionDetection=*false*,
>> groups="A,B")
>>
>>
>>
>> As an example,
>>
>>
>>
>> Let’s say we have a “Trades” cluster organized in groups by high level
>> business (Say – Credit, SecuritizedProducts, Equities etc.)
>>
>>
>>
>> Inside server nodes hosting “group=Credit” trades, one can have trade
>> regions for “Credit” products only (May be Bonds, Indexes, CDSs etc.).
>>
>> In case I see high load/demand in volume for my servers hosting trades
>> for “Credit” market, I should be able to *spawn a new Peer/CacheServer
>> member who belongs to “Credit” group only on-demand/trigger* (So that I
>> don’t pull regions from other cluster *groups/server nodes* which I am
>> not interested in)
>>
>>
>>
>> Thanks,
>>
>> Dharam
>>
>> This message is confidential and subject to terms at: http://
>> www.jpmorgan.com/emaildisclaimer including on confidentiality, legal
>> privilege, viruses and monitoring of electronic messages. If you are not
>> the intended recipient, please delete this message and notify the sender
>> immediately. Any unauthorized use is strictly prohibited.
>>
>
>
>
> --
> -John
> john.blum10101 (skype)
>

Reply via email to