Sending Asynchronous HTML Email in Grails with ActiveMQ, JMS and Gmail

Sending email asynchronously is an essential part of most Web applications and there are many ways in which to implement it. In this post I’ve chosen to demonstrate how to set up JMS, ActiveMQ and Gmail with the Grails Mail plugin to provide asynchronous email capabilities while only having to write a few lines of code, all thanks to some great plugins. I’ll also show the fantastic Grails Mail templating feature which uses GSP views to generate HTML emails along with a solution for one of the big bugs with it too!

Continue reading

Simple Aspects using Annotations in Grails

Aspect Oriented Programming is a concept which will be familiar to users of the Spring Framework as one of its core features. However, the details of how to get AOP working in Grails appear thin on the ground, so in this post I will show how to set up a simple aspect then configure and apply it using attributes. I will assume some familiarity with Spring AOP so I won’t explain the terminology or general concepts since they are exactly the sameĀ  in Java as they are in Grails. Continue reading

Rendering JSON In Grails. Part 1: Collections, Testing and the JSONBuilder

One of the many useful features Grails provides is the ability to quickly render data as JSON so it’s possible to interface with the many AJAX libraries available with a minimum of coding fuss, or provide an API to 3rd parties with very little effort. Having implemented such behaviour I’ve found that a little more than the basic understanding is helpful for success in real applications, so over the next 3 posts I will attempt to convey the simplicity and power of this feature while also giving some practical tips. Continue reading