$30 off During Our Annual Pro Sale. View Details »

BedCon 2013 - FeatureToggle Pattern with Togglz

BedCon 2013 - FeatureToggle Pattern with Togglz

Continuous Deployment with FeatureToggle Pattern, Implementation with Togglz Library.
My Short-Talk from http://bed-con.org/

Niko Köbler

April 04, 2013
Tweet

More Decks by Niko Köbler

Other Decks in Programming

Transcript

  1. • togglz.org • Open Source Java Library • Apache v2.0

    Licence • Current release: 2.0.0.Alpha1 • Download via Website or Central Maven Repository
  2. Maven Dependencies <!-- Togglz for Web applications --> <dependency> <groupId>org.togglz</groupId>

    <artifactId>togglz-servlet</artifactId> <version>1.1.0.Final</version> </dependency> <!-- CDI Integration (optional) --> <dependency> <groupId>org.togglz</groupId> <artifactId>togglz-cdi</artifactId> <version>1.1.0.Final</version> </dependency> <!-- JSF Integration (optional) --> <dependency> <groupId>org.togglz</groupId> <artifactId>togglz-jsf</artifactId> <version>1.1.0.Final</version> </dependency>
  3. FeatureEnum public enum MyFeatures implements Feature { @EnabledByDefault @Label("Smart First

    Feature") FIRST_FEATURE, @Label("Cool Second Feature") SECOND_FEATURE; @Override public boolean isActive() { return FeatureContext .getFeatureManager() .isActive(this); } }
  4. TogglzConfig public class MyTogglzConfiguration implements TogglzConfig { @Override public Class<?

    extends Feature> getFeatureClass() { return MyFeatures.class; } @Override public StateRepository getStateRepository() { return new FileBasedStateRepository( new File("/path/to/features.properties") ); } @Override public UserProvider getUserProvider() { return new NoOpUserProvider(); } }
  5. FeatureProxyFactoryBean <bean id="fancyService“ class="com.example.myapp.services.NewFancyService" /> <bean id="boringService" class="com.example.myapp.services.BoringService" /> <bean

    id="myService" class="org.togglz.spring.proxy.FeatureProxyFactoryBean"> <property name="feature" value="FANCY_FEATURE" /> <property name="active" ref="fancyService" /> <property name="inactive" ref="boringService" /> </bean>