Wednesday, June 27, 2018

Log exceptions with exceptional details . . .

Logging is generally considered a cross-cutting concern. So as logging exceptions is. An appropriate level of details added to exception log is always very helpful and gives a jump-start in investigating the root cause of an exception.

Grails provides good exception logging, filters out unnecessary stack traces (configurable by setting grails.full.stacktrace property) by default, that otherwise would be too long. It also provides configurable way of adding additional details to the exception log message. Additional details like request parameters can be added to exception log message (by setting the property  grails.exceptionresolver.logRequestParameters = true in Config.groovy) which is by default enabled in only development env). Also, certain sensible request parameters and values can be masked from exception logging by setting an additional property grails.exceptionresolver.params.exclude = ['password']).

In a Web or RESTful API application, request parameters added to exception log message cover all http methods like GET that send parameters as part of the query string. However, http methods like POST typically send parameters in the request body, but not in the query string. Logging request body along with exception message is as useful as logging request parameters. Grails doesn't provide a configurable way of adding this level of details to exception log message. But this can easily be added with minimal coding, configuration and by leveraging the underlying Spring framework.

Environment: Grails 2.5.4, Java 8 on MacOS High Sierra 10.13.5

Imagine, a Grails application providing various RESTful end-points that take JSON payload as the body in POST requests. If some exception arises while processing a request, an exception log that includes request payload received will be very helpful to investigate the root cause. This requires accessing the original http request body in an exception resolver at the time when the exception is raised. Grails default exception resolver class is: GrailsExceptionResolver. This class is extendable. All we need to do is override one of it's methods that forms the exception log message.

Extend GrailsExceptionResolver and override getRequestLogMessage(Throwable e, HttpServletRequest request). This method already has HttpServletRequest parameter. So, getting access to request body is possible, but it is not available. The problem is, by this time, the request body must have already been read either by calling getInputStream() or getReader() method in order to consume and process the JSON payload. Once read, it's not available anymore and subsequent reads only result in an exception: IllegalStateException. The only way to deal with this limitation is to wrap the original HttpServletRequest into a wrapper HttpServletRequestWrapper, cache it and pass it along the filter chain by making cached request available for multi-reads.

This is bit low-level to dive into in a Grails application. Grails 2 offers a high-level Filters support but it has limitations to use in this solution. So, we have to dive little deeper and put a solution by introducing a Servlet filter that caches and wraps the original request to make it available for multi-reads. But, remember Grails underpins Spring framework. So, it's always a layer to look into for customizations like this and see if there is anything readily available for adopting. In this case, there is a filter org.springframework.web.filter.CommonsRequestLoggingFilter which wraps the request into  org.springframework.web.util.ContentCachingRequestWrapper and is just appropriate for this solution to leverage.

Now, we have all pieces of the puzzle. Let's put these together into a solution.

Step-1

Extend GrailsExceptionResolver and overwrite getRequestLogMessage(Throwable e, HttpServletRequest request)method. The following is an example of extended exception resolver:
src/groovy/grails/logging/LogRequestBodyExceptionResolver.groovy
package com.giri.grails.logging import com.giri.grails.web.RequestCacheFilterUtil import org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver import org.springframework.http.HttpMethod import org.springframework.http.MediaType import javax.servlet.http.HttpServletRequest /** * Exception resolver, adds request body to exception log message by getting it from the request body cached by * {@link org.springframework.web.util.ContentCachingRequestWrapper} * * @see {@link org.springframework.web.util.ContentCachingRequestWrapper} * @see /src/templates/war/web.xml * @see /conf/spring/resources.groovy * * @author gpottepalem * Created on Jun 27, 2018 */ class LogRequestBodyExceptionResolver extends GrailsExceptionResolver { static final List LOG_PAYLOAD_FOR_HTTP_METHODS = [HttpMethod.POST, HttpMethod.PUT]*.name() static final List LOG_PAYLOAD_FOR_HTTP_CONTENT_TYPES = [MediaType.APPLICATION_JSON_VALUE] /** * Enhances Grails log message for logging exceptions by adding the original request payload to the exception * message * @param e the exception * @param request request * @return enhanced log message that includes request payload (body) */ @Override String getRequestLogMessage(Throwable e, HttpServletRequest request) { String logMessage = super.getRequestLogMessage(e, request) String payload = RequestCacheFilterUtil.getCachedRequestPayload(request) if (request.method in LOG_PAYLOAD_FOR_HTTP_METHODS && request.contentType in LOG_PAYLOAD_FOR_HTTP_CONTENT_TYPES) { logMessage += "\n${request.method} ${request.contentType} payload: ${payload}\n" } return logMessage } }

Here is the utility class that the above code snippet uses:
src/groovy/grails/web/RequestCacheFilterUtil.groovy
package com.giri.grails.web import org.springframework.web.util.ContentCachingRequestWrapper import org.springframework.web.util.WebUtils import javax.servlet.http.HttpServletRequest /** * Utility class. Provide methods for working on the cached request payload. The original request once per * request is cached by {@link ContentCachingRequestWrapper} in the filter * {@link org.springframework.web.filter.CommonsRequestLoggingFilter} setup in web.xml * * @see /src/templates/war/web.xml * * @author gpottepalem * Created on Jun 27, 2018 */ class RequestCacheFilterUtil { /** * Utility method to get payload of the cached request. * * @param request the request * @return payload as String * @throws UnsupportedEncodingException */ static String getCachedRequestPayload(final HttpServletRequest request) throws UnsupportedEncodingException { String payload ContentCachingRequestWrapper wrapper = WebUtils.getNativeRequest(request, ContentCachingRequestWrapper.class) if (wrapper) { byte[] buffer = wrapper.getContentAsByteArray() if (buffer) { payload = new String(buf, 0, buf.length, wrapper.getCharacterEncoding()) } } return payload } }

Once we have extended Grails provided GrailsExceptionResolver class as shown above, we need to override Grails provided exception resolver and register this as our application's exception handler. A bean definition in resources.groovy like the following will exactly do that:
grails-app/conf/spring/resources.goovy
beans = { ... // custom exception handler to log request body in addition to log message for exceptions exceptionHandler(LogRequestBodyExceptionResolver) { exceptionMappings = [ 'java.lang.Exception': '/error' ] } }

That is one side of this problem which takes care of logging request body along with the exception message for exceptions.

Step-2

The other side of the problem is to put a solution to make request body available for multiple reads. Typically once getInputStream() or getReader() is called to consume request body from  HttpServletRequest the next call will throw an exception preventing it to call multiple times. This needs a way to cache the request and wrap it using HttpServletRequestWrapper to make it's body readable multiple times. Fortunately Spring comes with ContentCachingRequestWrapper that exactly does this. But this needs to be done in a filter to wrap the request. Grails filters will not let this level of customization with request or response objects available in filters. This needs a servlet filter configuration. Spring comes with few handy implementations of filters that use ContentCachingRequestWrapper in them. One such useful filter class is: CommonsRequestLoggingFilter that allows request customizations. This filter can be setup in web.xml as a servlet filter that in-turn caches and wraps HttpServletRequest.

A typical Grails application doesn't include web.xml as it gets created when the application war file is built. In order to get this filter definition into the generated web.xml that gets bundled into war file, we need to install Grails templates. These are the templates that Grails framework uses for code generations. For customizing any code generation, we need to install and make changes to the corresponding template, in this case templates/war/web.xml file is the one we add a filter into.

Running the command: grails install-templates, installs all templates that Grails framework itself uses to generate code under src/templates dir. For this solution, we don't need all installed template files. We can delete all except web/web.xml once templates.

Edit war/web.xml and add the following filter entry:
... <!-- ================ Custom filters BEGIN ================ --> <!-- Filter provides org.springframework.web.util.ContentCachingRequestWrapper which in turn caches and makes request body multi-readable. We leverage the cached request and access request body in LogRequestBodyExceptionResolver for logging enhanced exception message that includes request payload. --> <filter> <filter-name>commonsRequestLoggingFilter</filter-name> <filter-class>org.springframework.web.filter.CommonsRequestLoggingFilter</filter-class> <init-param> <param-name>includePayload</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>includeClientInfo</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>includeQueryString</param-name> <param-value>true</param-value> </init-param> </filter> <!-- URL patterns the filter is applied to --> <filter-mapping> <filter-name>commonsRequestLoggingFilter</filter-name> <url-pattern>/sites/*</url-pattern> <url-pattern>/api/*</url-pattern> <url-pattern>/admin/*</url-pattern> </filter-mapping> <!-- ================ Custom Filters END ================= --> ...

This makes every request go through this filter for listed URL patterns.

With this, we have enhanced Grails provided exception resolver that adds request body to exception log message which gets logged when an exception arises while processing a http request that includes body.

TIP

As this solution leverages Spring provided request logging filter that offers logging request parameters, body and client-info of every request for debug level when enabled, we can as well have debug log level enabled for this class in development in Config.groovy:

log4j = { environments { development { ... debug 'org.springframework.web.filter.CommonsRequestLoggingFilter' ... } } }

This will log every request that goes through this filter with extra enabled details in debug mode.

References


  • Grails Filters Doc
  • Grails install-templates command
  • Grails Goodness: Exception Methods in Controllers
  • Logging http request and response with Spring 4


  • Sunday, January 28, 2018

    Add time-zone sense . . .

    As today's applications run from the Cloud hardware and serve requests coming in from time-zones spread across the globe, date-time-zone handling becomes more sensitive than ever. Applications need to be designed and built with this sensible capability and need to have not just Date-Time sense but also added Zone sense.

    Recently, I had to work on adding Timestamp and Zone capability to a Grails3 application. The initial implementation & business-logic around a couple of Date-Time sensitive fields was written just to track Date in MM/dd/yyyy format using java.util.Date. The new requirement was to capture date, timestamp and timezone. Sounds simple, but not really ;). It actually involved a bit of exploration on many fronts including: Java, Hibernate, Grails and PostgreSQL database.

    Environment: Grails 3.2.3, Java 8, PostgreSQL on MacOS High Sierra 10.13.2

    First Steps - Towards the right direction (Java 8 Date-Time classes)

    Java 8 Date Time classes

    I did some first-hand reading on Java 8 date-time classes from java.time package and an up-front research on the support for these classes in PostgreaSQL, Hibernate, Spring Boot and Grails.

    Java 8 (at last) added fluent date-time-zone API classes that are immutable, thread-safe and based on ISO 8601 calendar. I looked into details of few classes like: Instant, LocalDateTime, ZonedDateTime and OffsetDateTime. From Java docs, OffsetDateTime is the class recommended for modeling date-time concepts in more detail and when communicating with database/networking. After experimenting little bit all these classes, without further exploration I chose java.time.OffsetDateTime class over java.util.Date.

    java.time.Instant - an instantaneous point on the time line in UTC zone
    e.g 2018-01-21T12:21:12.122Z indicating Jan 21, 2018 12:21 pm 12 seconds and 122 milliseconds, Z stands for UTC timezone)

    java.time.LocalDateTime - date-time with no timezone information
    e.g. 2018-01-21T07:21:12.122 indicating Sun Jan 21, 2018 07:21 am 12 seconds and 122 milliseconds with no timezone, as my system clock is set to EST, this is the time in EST America/New_York zone

    java.time.ZonedDateTime - current date time in the current timezone with offset from UTC
    e.g. 2018-01-21T07:21:12.122-05:00[America/New_York] indicating Sun Jan 21, 2018 07:21 am 12 seconds and 122 milliseconds with timezone offset and timezone. As my system clock is set to EST, this is the time in EST America/New_York zone. It's more like LocalDateTime with offset from UTC timezone but with local timezone)

    java.time.OffsetDateTime - current date time in the current timezone with offset from UTC
    e.g. 2018-01-21T07:21:12.122-05:00 indicating Sun Jan 21, 2018 07:21 am 12 seconds and 122 milliseconds with timezone offset. As my system clock is set to EST, this is the time in EST with -05:00 offset that indicates the zone. It's more like LocalDateTime with offset from UTC timezone. Offset indicates the zone.)

    Other useful classes

    Next Steps - Along the path (PostgreSQL)

    PostgreSQL

    It is quite common to leverage Grails Database Migration Plugin in a Grails application to manage database changes. When model changes, running the plugin provided dbm-gorm-diff command generates schema changes as a groovy script. For java.util.Date and java.time Date classes the plugin generated change-log script will have column types set to: TIMESTAMP WITHOUT TIME ZONE for PostgreSQL.

    For instance, if a domain class had two new properties:
    Agreement.groovy
    class Agreement { ... Date signedDate Date expirationDate ... }

    Then running dbm-gorm-diff
    e.g. grails -Dgrails.env=development dbm-gorm-diff agreement-changes.groovy

    would have change-log script generated for the model changes as follows:
    databaseChangeLog = { changeSet(author: "Gpottepalem (generated)", id: "1234567890123-1") { createTable(tableName: "agreement") { ... column(name: "signed_date", type: "TIMESTAMP WITHOUT TIME ZONE") { constraints(nullable: "false") } column(name: "expiration_date", type: "TIMESTAMP WITHOUT TIME ZONE") { constraints(nullable: "false") } ... } } }

    That clearly indicates NO time-zone details are stored in the database.

    Move on - Application Code Changes (Grails)

    Grails application code

    Step-1 Dependencies - Add compile-time and run-time dependencies to gradle build script.

    PostgreSQL jdbc driver
    - Use the correct PostgreSQL JDBC driver for Java 8 date time classes support. Make sure you are using JRE 8+ driver. If not, change it:

    Hibernate - Next add hibernate Java8 compile time dependency.

    Grails - Then add grails Java8 dependency plugin

    Following is the Gradle build script with these dependencies added:
    build.gradle
    dependencies { ... runtime "org.postgresql:postgresql:42.1.4" //Java JDBC 4.2 (JRE 8+) driver for PostgreSQL database compile 'org.hibernate:hibernate-java8 //hibernate java 8 java.time classes support compile "org.grails.plugins:grails-java8" //grails java 8 java.time classes support ... }

    Step-2 Domain Model - Change Date types to OffsetDateTime

    Agreement.groovy
    class Agreement { ... OffsetDateTime signedDate OffsetDateTime expirationDate ... }

    Assuming that the model had Date types earlier and the generated dbm change-log script: agreement-changes.groovy was already applied to database, now as the domain object properties are changed from java.util.Date to java.time.OffsetDateTime, we need to generate change-log script for these changes and apply them to database. But, the command dbm-gorm-diff will not generate the change-log script to have the right PostgreSQL type: TYPE TIMESTAMP WITH TIMEZONE. So, it requires a manual dbm change-log like:

    e.g. agreement-date-type-changes.groovy
    databaseChangeLog = { changeSet(author: 'gpottepalem', id: 'alter signed_date to store time zone') { grailsChange { change { sql.execute('ALTER TABLE myschema.my_table ALTER COLUMN signed_date TYPE TIMESTAMP WITH TIME ZONE') } } } changeSet(author: 'gpottepalem', id: 'alter expiration_date to store time zone') { grailsChange { change { sql.execute('ALTER TABLE myschema.my_table ALTER COLUMN expiration_date TYPE TIMESTAMP WITH TIME ZONE') } } } }

    With this schema change applied to database, when the domain object is saved, OffsetDate gets stored in PostgreSQL database with timestamp and offset indicating the time zone.

    Step-3 Views - JSON views

    If you have JSON views in the application, you need to make sure that the OffsetDateTime fields' data looks good and is as expected in the JSON output produced. Unlike java.util.Date fields, java.time.OffsetDateTime fields output data won't get formatted. The JSON output for OffsetDateTime fields not only contain all of it's direct properties but also recursive properties of all of it's object references accessible via getXXX() methods. e.g. OffsetDateTime's getOffset() method's returned ZoneOffset object's getAvailableZoneIds() method's returned all zoneIds will show up as well.

    For instance, if you have a view under grails-app/views/agreement/_agreement.gson like:
    model { Agreement agreement } json.agreement { signedOn agreement.signedDate expiresOn agreement.expirationDate }

    You will have it rendered in JSON as:
    { "agreement": { "signedOn": { "dayOfMonth": 27, "dayOfWeek": "SATURDAY", "dayOfYear": 27, "hour": 12, "minute": 44, "month": "JANUARY", "monthValue": 1, "nano": 356000000, "offset": { "availableZoneIds": [ "Asia/Aden", "America/Cuiaba", "Etc/GMT+9", ... ], "id": "-05:00", "rules": { "fixedOffset": true, "transitionRules": [], "transitions": [] }, "totalSeconds": -18000 }, "second": 35, "year": 2018 }, "expiresOn": { "dayOfMonth": 27, ... } } }

    A quick solution is to simply convert java.time.OffsetDateTime to java.util.Date or simply stringify using toString() depending on your needs. The following gson template:
    import java.time.Instant import java.time.OffsetDateTime model { Agreement agreement } json.agreement { signedOn agreement.signedDate.toString() //current zone date-time with offset from UTC expiresOn Date.from(agreement.expirationDate.toInstant()) //OffsetDateTime to Date in UTC timezone }
    will produce the output as:
    { "agreement": { "signedOn": "2018-01-27T17:10:57.443-05:00", "expiresOn": "2018-01-27T22:10:57Z" } }

    Gotcha

    PostgreSQL stores offset when OffsetDateTime field is persisted. But when queried, will not give stored offset back. Instead, gives data in the timezone the database is set (for instance UTC) with no offset. Databases add their own steep learning curve to deal with date-time-zone data ;)

    Tip

    Grails console is the handy tool for explorations with changes like this in a Grails application.
    e.g. A simple Grails script to persist and retrive Agreement object
    import com.my.app.Agreement import java.time.OffsetDateTime println Agreement.count() Agreement agreement = new Agreement( signedDate: OffsetDateTime.now(), expirationDate: OffsetDateTime.now().plusYears(1) ).save(flush: true, failOnError: true) println Agreement.count() Agreement.all.each { println "id:${it.id}, signedDate:${it.signedDate} expirationDate:${it.expirationDate}" }

    Summary

    Date - is the central issue of Y2K problem which costed IT industry billions of dollars and isn't trivial yet. Even in modern languages and frameworks, it hasn't become as primitive as it can become, and dealing with it requires a special care and attention from all levels of the application right from presentation, business logic, and up to the persistence.

    In modern Java applications, Java 8's added date.time classes have become better if not any simpler, but is a definitive way to go with, when dealing with date, time and zone in present times!

    References

    
    

    Sunday, December 03, 2017

    G3 Summit 2017 - A Great Experience . . .

    It was a great learning experience for me at this year's G3 Summit 2017 from Nov 28 - Dec 1, 2017 in Austin, Texas. After following Grails for many years and experiencing at work for about 2+ years, going to this conference definitely made me a better Grails Developer and I have several take-aways from this.

    It was a 4-day conference, first two days were loaded with hands-on workshops followed by two full days of different one-and-half hour sessions in 3 parallel tracks on various Groovy, Grails and Gradle topics.

    Day-1: Workshop

    I attended Alexa Work Shop by Ryan Vanderwerf which was a good introduction to Amazon Alexa, it's Appkit, Architecture, SDKs, Skills, Intents Schema, Alexa Grails Plugin followed by a hands-on development of a simple Quiz application for Alexa and testing it using Alexa Skill Testing tool Echosim.

    Day-2: Workshop

    Second day I attended Powerful Testing Techniques for Groovy by Jeff Scott Brown. It was a good presentation on complete coverage of testing and it's importance with special focus on Groovy and Grails including the recent new Traits based Testing Framework introduced in Grails 3.3.x, followed by a hands-on session based on one of the Grails guides - Testing a Secured Grails Application. It was a very informative session overall.

    Key Note: Opening Night

    Paul King gave an update on Groovy and it's roadmap touching what's coming in 2.6 and 3.0 followed by Graeme Rocher on Grails and it's future giving brief insights into the already solid Grails 3.3, Gorm 6.1 and what's coming in Grails 4 with Gorm 7. Graeme also briefed on Grails new project called Particle which will aim to solve complex problems in the micro-services world with an elegant Grails approach.

    Day-3: Sessions I attended

    Groovy the awesome parts - Paul King
    In this Groovy session, Paul King touched almost all awesome language features of Groovy with code snippets and explanations including DSL, IDE DSLs for code completion:GDSL(IntelliJ) & DSLD(Eclipse), AST transformations, Traits, Closures, GPars, Data Flows, @TypeChecked, @CompileStatic, Run-time meta-programming, Command Chains etc.

    It was a good session to know awesome parts of Groovy and how Groovy makes them possible.

    Monitoring & Metrics with Grails 3 - Jeff Brown
    This talk was all about a work-in-progress but almost ready for ver 1.0 (currently at 1.0.0 M3), a  metrics Plugin for Grails called  Grails Dropwizard Metrics which is based on Dropwizard Java library.  He also did a demo of it's practical application and showed how simple and easy it is to collect metrics of a running application and automate any followup actions based on metrics collected by applying just a couple of annotations in the code: @Metered and @Timed.

    It's definitely a plugin to check it out.

    Programming Groovy with Java 8 - Venkat Subramaniam
    As always Venkat came up with an awesome session by showing many small live coding examples of Groovy and Java primarily focusing on Collections and Streams with side-by-side comparisons. He demonstrated how one can take advantage of Laziness offered by Java 8 when working with collections through Streams and how well Java implemented it when many other programming languages including Groovy, Ruby, Python, JavaScript etc. only made the implementation elegant but didn't make it performant. He demonstrated clearly but concisely certain areas in the code while working with large sets of data where a Groovy Programmer can switch to Java 8 Streams to write performant code.

    With Groovy's seamless integration with Java, of course, Groovy programmers are in the best spot to enjoy best of both, always, without leaving Groovy.

    Grails Multi-project builds - Jeff Brown
    It was another great session by Jeff Brown. He showed how easy it is to take advantage of Gralde's support for multi-project builds and get benefited by it in in a Grails project by organizing it into a root Grails project with sub-projects of several Grails plugins and libraries.

    This seems clearly the way to start breaking down a monolithic giant complex Grails project into maintainable and dependable sub-projects without having any circular dependencies. He showed how Grails-core code-base itself is now organized into a multi-project Gradle build and this can be taken as a best example to look at.

    GORM and GraphQL - James Kleeh
    James Kleeh clearly started the session by making a point on how rigid REST is with end-points & their response schemas, and what GraphQL can offer to address this problem by giving the control to clients so that the client application can ask for what it needs and get back only what it asked for in the response. He also demonstrated a Grails GraphQL Demo app with GORM GraphQL plugin for Grails.

    Go and check it out.

    GORM 6 Q & A - Graeme Rocher & James Kleeh
    It was a great Q & A session with a small group of people attended. I got a change to talk with Graeme and James and get to know more details on GORM 6.1, some insights into the changes went into GORM 6.1 and reasons behind those. In response to my question about Grails future project Particle,  Graeme described little more details on what Grails is aiming to do and what kind of problems it's trying to solve in there. The discussion went on sharing many more thoughts and insights around GORM and Grails framework- the past, the present and the future.

    I am glad I attended this Q&A with Graeme and James.

    Day-4: Sessions I attended

    Polyglot Web Development with Grails 3 - Jeff Brown
    This was another wonderful session by Jeff Brown who started this session with an introduction to Polyglot Programming and it's benefits followed by a demo. He demonstrated and showed how easy it is to leverage other JVM programming languages in a Grails application. He took Clojure -a pure functional programming language on the JVM as an example, and showed how one can write business logic in pure Clojure functions, how easy it is to expose those functions as service methods in a Controller which is injected with a Proxy service bean that uses Groovy's magical method: missingMethod implementation to call Clojure functions. With this approach, calling service methods in Controller is like any other Grails Service methods. The controller doesn't need to know in which language these services are implemented. He showed all pretty neat techniques in achieving this with the very simple Grails Clojure plugin that he wrote.

    In Grails, polyglot programming can also be made possible as easy as it can be.

    Automated Strategies for building & Deploying Grails with Gradle - Eric Helgeson
    It was a pretty good session by Eric and he covered so many things in such a short one-and-half-hour fully informative session. He covered many available tools and things to do in order to achieve complete automation by doing everything as code right from taking the application code along the continuous integration path to production, and even beyond, all the way up to proactively responding to end-user issues.

    There were great many ideas, tools and implementation details to take away from this session.

    Grails 3, Gradle & AWS tour - Ryan Vanderwerf
    This session was a quick introduction to Amazon's Virtual Private Cloud(VPC), Network terminology, and Amazon Services like Route 53, EC2, S3, Elastic Bean Stalk, Lambda and Elastic Load Balancer etc. with few quick demos of AWS JAVA SDK plugin and some coverage of Amazon's Simple Email Service (SES),Simple Queue Service (SQS) and Simple Notification Service (SNS) etc. It was good to know that there are many Gradle plugins for automating Amazon services already, and SSHOOGR- a Groovy DSL for SSH to work with remote services.

    Getting Groovy with Google Home - Ryan Vanderwerf
    This session was also by Ryan which was very interesting to know what Google is offering at present in the area of Voice Controlled Gadgets and Devices like Google Home and what is available in Grails world to start writing applications for Google Home device. With a quick introduction to Google Actions (equivalent to Alexa Skills), Intents and available tools like factions CLI, Google console etc., he dived into demonstrating a Color Chooser app which he had written in Grails using Actions SDK for Java. He demoed, how one can ask Google Home to tell the lighter or darker color of any color which sends the voice request to the Grails app deployed on Amazon AWS but setup on Google Cloud that delivers the response as an answer back to Google Home device. Ryan also had written an in-depth guide on this which is available at OCI web site.

    Voice Controlled Devices is certainly the future way of interacting with applications & services, and a Grails Developer can already start writing apps in Grails for Google Home device. This was the very last session I attended and that concludes my experience with great G3 Summit 2017 - a Groovy, Grails and Gradle conference.

    Summary

    Overall, it was a great learning experience and I have several take-aways from this conference. Grails is a great community and this conference gave me an opportunity to meet many of the core committers of Groovy & Grails Framework, and other users & enthusiasts from Groovy, Grails and Gradle community.

    Links