2. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Agenda
The Allegro Situation
How to build a new World?
The way to improve
What’s in it for you?
3. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
The Allegro Situation
18. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
The first approach
Service
Auto deployable
Monitored
Auto scalable
Auto healable
Auto discoverable
19. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
How to build a new World?
28. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Multiple API versions
Header support
public class UserMediaType {
public static final String V1_JSON =
"application/vnd.allegro.user.v1+json”
public static final String V2_JSON =
"application/vnd.allegro.user.v2+json”
}
curl --dump-header - -H ”Accept: application/vnd.allegro.user.v2+json"
-X GET http://localhost:8080/users
29. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Multiple API versions
Content negotiation
@Path("/users")
@Consumes(AllegroUserMediaType.V1_JSON)
@Produces(AllegroUserMediaType.V1_JSON)
public class UsersEndpoint {
// [...]
@GET
@Produces(AllegroUserMediaType.V2_JSON)
public UserCollectionResponse findAllUsers() {
//[...]
}
}
30. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
How to configure it?
37. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Integration tests
Test without mocks
Run from IDE
public class UsersIntegrationTest {
private static Map<String, String> overrideConfiguration = Maps.newHashMap();
static { overrideConfiguration.put("property.name", "This was overwritten value"); }
@ClassRule
public static final RestServiceStarted DEPLOYED_SERVICE =
new RestServiceStarted(overrideConfiguration);
private WebTarget getUsersResourceWebTarget() {
return DEPLOYED_SERVICE.getWebTarget().path("users");
}
}
38. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
Monitoring
40. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Let’s see what happens
Graphite
# Metrics
metrics.reporters.graphite.enabled=true
metrics.reporters.graphite.host=graphite.service
metrics.reporters.graphite.port=2003
metrics.reporters.graphite.prefix=stats.Prod.service
metrics.reporters.interval=30
41. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
Monolith Alert
48. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
What’s in it for you?
49. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Use the latest tools
GradleW issue in Continuous Integration
Environment and parent POM issues.
Don’t do DDOS yourself and your partners’
sites.
50. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Change is the only constant
HTTP Server
Service API provider
Dependency injection engine
Deployment tools
51. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Focus on right metrics
import org.junit.Test;
import static net.trajano...
public class MediaTypesTest {
@Test
public void mediaTypesShouldBeValidUtilityClasses()
throws Throwable {
assertUtilityClassWellDefined(UserMediaType.class);
}
}
52. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Tools also lie
Metrics tend to lie
– Default PHP metrics in SonarQube
– Tested file
• 4535 CLOC
• Whole code written using imperative programming
How many violations are there?
54. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Learn to REST
REST is not so obvious
/api/bi/XYZ123/1
/recommendations/1/items
/offer/100?output=ESI/JSON
55. #AtmosphereConf @DebskiChris
Allegro The New World Improvement WIIFY
Community
Involve all developers in building the
Bootstrap.
Or they will build their own tools.
Łukasz Drumiński Mateusz Gajewski
@wendigo
56. Allegro The New World Improvement WIIFY
#AtmosphereConf @DebskiChris
Q & A